Java Reference
In-Depth Information
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
Meaning
Class
The class cannot be instantiated and may contain unimplemented methods.
abstract
Interface
All interfaces are abstract . The modiier is optional in interface
declarations.
m
g
O
Method
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 .
Method
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.
default
Class
The class cannot be subclassed.
final
Method
The method cannot be overridden.
Field
The ield cannot have its value changed. static final ields are
compile-time constants.
Variable
A local variable, method parameter, or exception parameter cannot have its
value changed.
Method
The method is implemented in some platform-dependent way (often in C).
No body is provided; the signature is followed by a semicolon.
native
<None> (package)
Class
A non- public class is accessible only in its package.
Interface
A non- public interface is accessible only in its package.
Member
A member that is not private , protected , or public has package
visibility and is accessible only within its package.
Member
The member is accessible only within the class that deines it.
private
Member
The member is accessible only within the package in which it is deined and
within subclasses.
protected
Class
The class is accessible anywhere its package is.
public
Search WWH ::




Custom Search