Java Reference
In-Depth Information
CHAPTER
8
O
BJECTS AND
C
LASSES
Objectives
To describe objects and classes, and use classes to model objects (§8.2).
■
To use UML graphical notation to describe classes and objects (§8.2).
■
To demonstrate how to define classes and create objects (§8.3).
■
To create objects using constructors (§8.4).
■
To access objects via object reference variables (§8.5).
■
To define a reference variable using a reference type (§8.5.1).
■
To access an object's data and methods using the object member access
operator (
.
) (§8.5.2).
■
To define data fields of reference types and assign default values for an
object's data fields (§8.5.3).
■
To distinguish between object reference variables and primitive data
type variables (§8.5.4).
■
To use the Java library classes
Date
,
Random
, and
JFrame
(§8.6).
■
To distinguish between instance and static variables and methods (§8.7).
■
To define private data fields with appropriate
get
and
set
methods
(§8.8).
■
To encapsulate data fields to make classes easy to maintain (§8.9).
■
To develop methods with object arguments and differentiate between
primitive-type arguments and object-type arguments (§8.10).
■
To store and process objects in arrays (§8.11).
■