Basic HTML version of Foils prepared July 6 99

Foil 32 Access control

From Use of Java Language in Computational Science DoD Modernization Users Group Conference Monterey -- June 7 99. by Nancy McCracken, Geoffrey C. Fox


The modifiers in the class head control how other classes can access this one:
  • public -- May be used by code outside the class package
  • private -- this class can only be used within current file
  • friendly(i.e. empty ClassModifier) -- class can be used only within current package (directory)
  • protected -- Only accessible to subclasses
These modifiers are also used for access control to the instance variables and methods.
There are other modifiers. For example, a static variable or method only has the same value for all instances of the class. A final variable cannot be assigned to (used for constants).



© 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 Tue Jul 6 1999