Java Reference
In-Depth Information
In that case, the fully qualified name of M consists of the fully qualified name of
C , followed by “ . ”, followed by the simple name of M .
• An array type has a fully qualified name if and only if its element type has a fully
qualified name.
In that case, the fully qualified name of an array type consists of the fully qualified
name of the component type of the array type followed by “ [] ”.
A local class does not have a fully qualified name.
Example 6.7-1. Fully Qualified Names
• The fully qualified name of the type long is “ long ”.
• The fully qualified name of the package java.lang is “ java.lang ” because it is
subpackage lang of package java .
• The fully qualified name of the class Object , which is defined in the package
java.lang , is “ java.lang.Object ”.
• The fully qualified name of the interface Enumeration , which is defined in the
package java.util , is “ java.util.Enumeration ”.
• The fully qualified name of the type “array of double ” is “ double[] ”.
• The fully qualified name of the type “array of array of array of array of
String ” is “ java.lang.String[][][][] ”.
In the code:
package points;
class Point { int x, y; }
class PointVec { Point[] vec; }
the fully qualified name of the type Point is “ points.Point ”; the fully qualified name of
the type PointVec is “ points.PointVec ”; and the fully qualified name of the type of the
field vec of class PointVec is “ points.Point[] ”.
Every primitive type, named package, top level class, and top level interface has a canon-
ical name :
• For every primitive type, named package, top level class, and top level interface,
the canonical name is the same as the fully qualified name.
Each member class, member interface, and array type may have a canonical name:
Search WWH ::




Custom Search