Access control

Access specifies the part of the Java program text within which the declared entity can be referred to by a qualified name, a field access expression, or a method invocation expression in which the method is not specified by a simple name. You can specify access control in a class, interface, method, or field declaration in order to control when access to a member is allowed. The default access is that a member can be accessed anywhere within the package that contains its declaration; other possibilities are public, protected, and private.

If a class or interface type is not declared public (that is, if it is declared protected or private), it may be accessed only from within the package where it is declared. If a member or constructor is declared private, then it is accessible only to other methods in the same class. 

ngrelr.gif (548 bytes)
class keyword
interface keyword
private keyword
protected keyword
public keyword

Source: The Java Language Specification. Copyright (C) 1996 Sun Microsystems, Inc.