Java Reference
In-Depth Information
8
Classes and Objects:
A Deeper Look
Is it a world to hide virtues in?
—William Shakespeare
But what, to serve
our private ends,
Forbids the cheating
of our friends?
—Charles Churchill
This above all: to thine own self
be true.
—William Shakespeare.
Objectives
In this chapter you'll:
Use the
throw
statement to
indicate that a problem has
occurred.
■
Use keyword
this
in a
constructor to call another
constructor in the same class.
■
Use
static
variables and
methods.
■
Import
static
members of
a class.
■
Use the
enum
type to create
sets of constants with unique
identifiers.
■
Declare
enum
constants with
parameters.
■
Use
BigDecimal
for precise
monetary calculations.
■