Chapter 5


Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Appendix C.  Answers to Review Questions


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


A method definition looks as follows:

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


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


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


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


Recursion is the act of a method calling itself.


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


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


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.


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

 Math.tan( angle ) 


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

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: