Chapter 5. Methods

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Part I:  Java Foundation


In this chapter you will learn:

  • The concept of divide-and-conquer

  • The format of a Java method

  • How to implement methods

  • How to call methods

  • Method access modifiers

  • Variable scoping rules with respect with methods

  • Recursion versus iteration

  • Overloading methods

  • Introduction to Java class libraries

At this point in your arsenal of Java programming knowledge, you can create variables of differing types and manipulate them. For more complex operations you can modify them conditionally or derive values through iterative means.

Assuming you completed the exercises in the previous chapter, you have a good set of code that computes prime numbers, but what happens when you need to compute prime numbers again in another application? It would be nice to package that piece of code you wrote to determine whether a number is prime in such a way that you can reuse it.


       
    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