Basic HTML version of Foils prepared 9 Sept 1997

Foil 15 Method Definitions

From Java to be used in (Scientific) Computing Part II: Java Language and Object-Oriented Concepts Basic Simulation Track for Computational Science CPS615 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox


1 Subprograms in Java are called methods. The definition format is
  • Returntype Methodname ( Parameterlist )
  • {
    • declarations and statements
  • }
2 The parameter list contains the types and names of all the parameters.
3 The declarations and statements are called the body of the method. Parameter names and variables declared in the body are local to it.
4 Control returns from the methods either when the body is finished execution or a return statement is encountered. Return statements may also return a result.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Feb 22 1998