NAMES
Determining the Meaning of a Name
6.5
6.5   Determining the Meaning of a Name
The meaning of a name in Java depends on the context in which it is used. The
determination of the meaning of a name requires three steps. First, context causes
a name syntactically to fall into one of five categories:
PackageName
,
TypeName
,
ExpressionName
,
MethodName
, or
AmbiguousName
. Second, a name that is ini 
tially classified by its context as an
AmbiguousName
 is then reclassified by certain
scoping rules to be a
PackageName
,
TypeName
, or
ExpressionName
. Third, the
resulting category then dictates the final determination of the meaning of the name
(or a compilation error if the name has no meaning).
PackageName:
Identifier
PackageName
 .
Identifier
TypeName:
Identifier
PackageName
 .
Identifier
ExpressionName:
Identifier
AmbiguousName
 .
Identifier
MethodName:
Identifier
AmbiguousName
 .
Identifier
AmbiguousName:
Identifier
AmbiguousName
 .
Identifier
Java's use of context helps to minimize name conflicts between entities of dif 
ferent kinds. Such conflicts will be rare if the naming conventions described in
 6.8 are followed. Nevertheless, conflicts may arise unintentionally as types
developed by different programmers or different organizations evolve. For exam 
ple, types, methods, and fields may have the same name. Java never has trouble
distinguishing between a method and a field with the same name, since the context
of a use always tells whether a method or a field is intended.
89






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

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