8.1
Class Declaration
CLASSES
A field may be declared
final
 ( 8.3.1.2), in which case it cannot be assigned to
except as part of its declaration. Any field declaration may include an initializer;
the declaration of a
final
 field must include an initializer.
Method declarations ( 8.4) describe code that may be invoked by method
invocation expressions ( 15.11). A class method is invoked relative to the class
type; an instance method is invoked with respect to some particular object that is
an instance of the class type. A method whose declaration does not indicate how it
is implemented must be declared
abstract
. A method may be declared
final
( 8.4.3.3), in which case it cannot be hidden or overridden. A method may be
implemented by platform dependent
native
 code ( 8.4.3.4). A
synchronized
method ( 8.4.3.5) automatically locks an object before executing its body and
automatically unlocks the object on return, as if by use of a
synchronized
 state 
ment ( 14.17), thus allowing its activities to be synchronized with those of other
threads ( 17).
Method names may be overloaded ( 8.4.7).
Static initializers ( 8.5) are blocks of executable code that may be used to
help initialize a class when it is first loaded ( 12.4).
Constructors ( 8.6) are similar to methods, but cannot be invoked directly by
a method call; they are used to initialize new class instances. Like methods, they
may be overloaded ( 8.6.6).
8.1   Class Declaration
A
class declaration
 specifies a new reference type:
ClassDeclaration:
ClassModifiers
opt
 class
Identifier Super
opt
Interfaces
opt
ClassBody
If a class is declared in a named package ( 7.4.1) with fully qualified name
P
( 6.7), then the class has the fully qualified name
P.
Identifier
. If the class is in an
unnamed package ( 7.4.2), then the class has the fully qualified name
Identifier
.
In the example:
class Point { int x, y; }
the class
Point
 is declared in a compilation unit with no
package
 statement, and
thus
Point
 is its fully qualified name, whereas in the example:
package vista;
class Point { int x, y; }
128






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