Java Reference
In-Depth Information
6.5.5.2. Qualified Type Names
If a type name is of the form
Q.Id
, then
Q
must be either a type name or a package name.
If
Id
names exactly one accessible type (§
6.6
) that is a member of the type or package de-
noted by
Q
, then the qualified type name denotes that type.
within
Q
and
Q
is parameterized, then a compile-time error occurs.
Example 6.5.5.2-1. Qualified Type Names
class Test {
public static void main(String[] args) {
java.util.Date date =
new java.util.Date(System.currentTimeMillis());
System.out.println(date.toLocaleString());
}
}
This program produced the following output the first time it was run:
Sun Jan 21 22:56:29 1996
In this example, the name
java.util.Date
must denote a type, so we first use the procedure
recursively to determine if
java.util
is an accessible type or a package, which it is, and
then look to see if the type
Date
is accessible in this package.
6.5.6. Meaning of Expression Names
The meaning of a name classified as an
ExpressionName
is determined as follows.
6.5.6.1. Simple Expression Names
If an expression name consists of a single
Identifier
, then there must be exactly one de-
claration denoting either a local variable, parameter, or field visible (§
6.4.1
) at the point at
which the
Identifier
occurs. Otherwise, a compile-time error occurs.