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.
If Id does not name a member type (§ 8.5 , § 9.5 ) within Q , or there is not exactly one ac-
cessible (§ 6.6 ) member type named Id within Q , or Id names a static member type (§ 8.5.1 )
within Q and Q is parameterized, then a compile-time error occurs.
Example 6.5.5.2-1. Qualified Type Names
Click here to view code image
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.
If the declaration denotes an instance variable (§ 8.3 ) , the expression name must appear
within the declaration of an instance method (§ 8.4 ), constructor (§ 8.8 ) , instance initializer
8.6 ) , or instance variable initializer (§ 8.3.2.2 ) . If the expression name appears within a
static method (§ 8.4.3.2 ) , static initializer (§ 8.7 ) , or initializer for a static variable (§ 8.3.2.1 ,
§ 12.4.2 ) , then a compile-time error occurs.
Search WWH ::




Custom Search