Chapter 5

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Appendix C.  Answers to Review Questions


A1:

Divide and conquer is breaking down a large problem into smaller more manageable problems.

A2:

A method definition looks as follows:

 return_type method_name( parameter_list )  {      declarations and statements...  } 

A3:

A method's signature consists of the method name, return type, and parameter list.

A4:

You specify that a method is not going to return a value by specifying the void return type in the method signature.

A5:

The three types of scope are

  • Class Scope: Available to all methods in the class

  • Block Scope: Available only with the block it is declared to, or within nested blocks

  • Method Scope: Special type for labels used with break and continue statements

A6:

Recursion is the act of a method calling itself.

A7:

Any problem that can be solved using recursion can be solved using iteration and iteration has far better performance, therefore use iteration.

A8:

Method overloading is defining multiple methods with the same name but different signatures.

A9:

Both of these methods can exist because their parameter lists are different. If two methods only differ by return type then they cannot coexist, but as long as the parameter list is different there is no problem.

A10:

You access the Math methods by appending the Math class with a period and then specifying the method name, for example:

 Math.tan( angle ) 


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net