Java Reference
In-Depth Information
4.3. Reference Types and Values
There are four kinds of reference types : class types (§8), interface types (§9), type variables
4.4 ) , and array types (§10).
ReferenceType:
ClassOrInterfaceType
TypeVariable
ArrayType
ClassOrInterfaceType:
ClassType
InterfaceType
ClassType:
TypeDeclSpecifier TypeArguments opt
InterfaceType:
TypeDeclSpecifier TypeArguments opt
TypeDeclSpecifier:
TypeName
ClassOrInterfaceType . Identifier
TypeName:
Identifier
TypeName . Identifier
TypeVariable:
Identifier
ArrayType:
Type [ ]
The sample code:
Click here to view code image
class Point { int[] metrics; }
interface Move { void move(int deltax, int deltay); }
declares a class type Point , an interface type Move , and uses an array type int[] (an array
of int ) to declare the field metrics of the class Point .
A class or interface type consists of a type declaration specifier , optionally followed by
type arguments (§ 4.5.1 ) . If type arguments appear anywhere in a class or interface type, it
is a parameterized type (§ 4.5 ) .
Search WWH ::




Custom Search