8.1.1
Scope of a Class Type Name
CLASSES
8.1.1   Scope of a Class Type Name
The
Identifier
 in a class declaration specifies the name of the class. This class
name has as its scope ( 6.3) the entire package in which the class is declared. As
an example, the compilation unit:
package points;
class Point {
int x, y;
//
coordinates
PointColor color;
//
color of this point
Point next;
//
next point with this color
static int nPoints;
}
class PointColor {
Point first;
//
first point with this color
PointColor(int color) {
this.color = color;
}
private int color;
//
color components
}
defines two classes that use each other in the declarations of their class members.
Because the class type names
Point
 and
PointColor
 have the entire package
points
, including the entire current compilation unit, as their scope, this example
compiles correctly that is, forward reference is not a problem.
8.1.2   Class Modifiers
A class declaration may include
class modifiers
.
ClassModifiers:
ClassModifier
ClassModifiers ClassModifier
ClassModifier: one of
public
abstract final
The access modifier
public
 is discussed in  6.6. A compile time error occurs if
the same modifier appears more than once in a class declaration. If two or more
class modifiers appear in a class declaration, then it is customary, though not
required, that they appear in the order consistent with that shown above in the pro 
duction for
ClassModifier
.
130






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

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