Basic HTML version of Foils prepared 9 Sept 1997

Foil 25 Java Language -- Types of Methods

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


MethodModifier ReturnType Name(argType1 arg1, ......)
Returntypes are either simple types (int, byte etc.), arrays or class names
Possible MethodModifiers are:
  • public -- This method is accessible by all methods inside and outside class
  • protected -- This method is only accessible by a subclass
  • private -- This method is only accessible to other methods in this class
  • friendly(i.e. empty) -- This method is accessible by methods in classes that are in same package
  • final -- a method that cannot be overriden
  • static -- This method is shared by ALL instances of this class and can be invoked with <Class>.method syntax as well as <Instance>.method
  • synchronized -- This method locks object on entry and unlocks it on exit. If the object is already locked, the method waits until the lock is released before executing -- can be used on methods or statement blocks
  • native -- to declare methods implemented in a platform -- dependent language, e.g. C.



© 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