6.8
Naming Conventions
NAMES
The fully qualified name of a class or interface that is declared in an unnamed
package is the simple name of the class or interface.
The fully qualified name of a class or interface that is declared in a named
package consists of the fully qualified name of the package, followed by
.
,
followed by the simple name of the class or interface.
The fully qualified name of an array type consists of the fully qualified name
of the component type of the array type followed by
[]
.
Examples:
The fully qualified name of the type
long
is
long
.
The fully qualified name of the standard 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 example:
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[]
.
6.8 Naming Conventions
The Java system and standard classes attempt to use, whenever possible, names
chosen according to the conventions presented here. These conventions help to
make code more readable and avoid certain kinds of name conflicts.
106
footer
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