6
C H A P T E R
Names
The Tao that can be told is not the eternal Tao;
The name that can be named is not the eternal name.
The Nameless is the origin of Heaven and Earth;
The Named is the mother of all things.
Lao Tsu (c. 6th century
BC
)
N
AMES are used to refer to entities declared in a Java program. A declared
entity ( 6.1) is a package, class type, interface type, member (field or method) of a
reference type, parameter (to a method, constructor, or exception handler), or
local variable.
Names in Java programs are either simple, consisting of a single identifier, or
qualified, consisting of a sequence of identifiers separated by
.
tokens ( 6.2).
Every name introduced by a declaration has a
scope
( 6.3), which is the part
of the Java program text within which the declared entity can be referred to by a
simple name.
Packages and reference types (that is, class types, interface types, and array
types) have members ( 6.4). A member can be referred to using a qualified name
N.x
, where
N
is a simple or qualified name and
x
is an identifier. If
N
names a
package, then
x
is a member of that package, which is either a class or interface
type or a subpackage. If
N
names a reference type or a variable of a reference type,
then
x
names a member of that type, which is either a field or a method.
In determining the meaning of a name ( 6.5), Java uses the context of the
occurrence to disambiguate among packages, types, variables, and methods with
the same name.
Access control ( 6.6) can be specified in a class, interface, method, or field
declaration to control when
access
to a member is allowed. Access is a different
concept from scope; 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 ( 15.10), or a method invocation expression ( 15.11) in which the
method is not specified by a simple name. The default access is that a member can
77
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved