chapter by listing the Java modifiers, explaining what types of Java constructs they
can modify, and explaining what they do. Table 3-2 has the details; you can also
refer back to “Overview of Classes” on page 97 and “Field Declaration Syntax” on
page 101 as well as “Method Modifiers” on page 68 .
Table 3-2. Java modiiers
Modiier Used on
The class cannot be instantiated and may contain unimplemented methods.
All interfaces are abstract . The modiier is optional in interface
No body is provided for the method; it is provided by a subclass. The signature
is followed by a semicolon. The enclosing class must also be abstract .
Implementation of this interface method is optional. The interface provides a
default implementation for classes that elect not to implement it. See Chapter
4 for more details.
The class cannot be subclassed.
The method cannot be overridden.
The ield cannot have its value changed. static final ields are
A local variable, method parameter, or exception parameter cannot have its
The method is implemented in some platform-dependent way (often in C).
No body is provided; the signature is followed by a semicolon.
A non- public class is accessible only in its package.
A non- public interface is accessible only in its package.
A member that is not private , protected , or public has package
visibility and is accessible only within its package.
The member is accessible only within the class that deines it.
The member is accessible only within the package in which it is deined and
The class is accessible anywhere its package is.