all, section 5.
5. Class Relationships
Class declarations define new
reference types and describe how they are implemented.
Constructors 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.
Static initializers are blocks of executable code
hat may be used to help initialize a class when it is first
The body of a class declares members,
static initializers, and constructors.
The scope of the name of a member is the
entire declaration of the class to which the member belongs.
Field, method, and
constructor declarations may include the access modifiers public,
protected, or private. The
members of a class include both declared and inherited members.
Newly declared fields can hide fields
declared in a superclass or superinterface. Newly declared methods can hide, implement, or override methods
declared in a superclass.
visibility modifier: public/private/protected
Return type: void/primitive type/reference to a object
Class methods/Class variables are declared with static.
Static declaration inside a method change the lifetime of
© by csfac. All Rights Reserved (2010).
It is not allowed to print these pages on a CAST printer.
Last modified: 01/April/10 (17:16)