6.5.4
Meaning of Type Names
NAMES
is possible that the identifier occurs within the scope of more than one type with
that name, in which case the type denoted by the name is determined as follows:
If a type with that name is declared in the current compilation unit ( 7.3),
either by a single type import declaration ( 7.5.1) or by a declaration of a
class or interface type ( 7.6), then the simple type name denotes that type.
Otherwise, if a type with that name is declared in another compilation unit
( 7.3) of the package ( 7.1) containing the identifier, then the identifier
denotes that type. Note that, in systems that store compilation units in a file
system, such a compilation unit must have a file name that is the name of the
type ( 7.6).
Otherwise, if a type of that name is declared by exactly one type import on 
demand declaration ( 7.5.2) of the compilation unit containing the identifier,
then the simple type name denotes that type.
Otherwise, if a type of that name is declared by more than one type import 
on demand declaration of the compilation unit, then the name is ambiguous as
a type name; a compile time error occurs.
Otherwise, the name is undefined as a type name; a compile time error occurs.
This order for considering type declarations is designed to choose the most
explicit of two or more applicable type declarations.
6.5.4.2
Qualified Type Names
If a type name is of the form
Q.Id
, then
Q
 must be a package name. The type
name
Q.Id
 names a type that is the member named
Id
 within the package named
by
Q
. If
Q
 does not name an accessible package, or
Id
 does not name a type within
that package, or the type named
Id
 within that package is not accessible ( 6.6),
then a compile time error occurs.
The example:
package wnj.test;
class Test {
public static void main(String[] args) {
java.util.Date date =
new java.util.Date(System.currentTimeMillis());
System.out.println(date.toLocaleString());
}
}
produced the following output the first time it was run:
Sun Jan 21 22:56:29 1996
94






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