Basic HTML version of Foils prepared June 5 99

Foil 48 Access control

From Java Language in the Computer Science Curriculum ADMI Tutorial Duluth Minnesota -- June 3 99. by Geoffrey C. Fox


1 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
2 These modifiers are also used for access control to the instance variables and methods.
3 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).

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 Sat Jun 5 1999