C
e
r
t
P
r
s
8
/
J
a
v
a
5
C
e
r
t
.
S
t
u
d
y
G
u
i
d
e
/
S
i
e
r
r
a
-
B
a
t
e
s
/
2
2
5
3
6
0
-
6
/
C
h
a
p
t
e
r
1
B
l
i
n
d
F
o
l
i
o
1
Declarations and
Access Control
CERTIFICATION OBJECTIVES
l Declare Classes & Interfaces
l Develop Interfaces &
Abstract Classes
l Use Primitives, Arrays, Enums, &
Legal Identifiers
l Use Static Methods, JavaBeans
Naming, & Var-Args
3 Two-Minute Drill
Q&A Self Test
ch1-1123f.indd 1
11/28/05 12:24:13 AM
C
e
r
t
P
r
s
8
/
J
a
v
a
5
C
e
r
t
.
S
t
u
d
y
G
u
i
d
e
/
S
i
e
r
r
a
-
B
a
t
e
s
/
2
2
5
3
6
0
-
6
/
C
h
a
p
t
e
r
1
Chapter 1: Declarations and Access Control
W
e assume that because you're planning on becoming certified, you already know
the basics of Java. If you're completely new to the language, this chapter—and the
rest of the book—will be confusing; so be sure you know at least the basics of the
language before diving into this book. That said, we're starting with a brief, high-level refresher to
put you back in the Java mood, in case you've been away for awhile.
Java Refresher
A Java program is mostly a collection of objects talking to other objects by invoking
each other's methods. Every object is of a certain type, and that type is defined by a
class or an interface. Most Java programs use a collection of objects of many different
types.
n Class A template that describes the kinds of state and behavior that objects
of its type support.
n Object At runtime, when the Java Virtual Machine (JVM) encounters the
new keyword, it will use the appropriate class to make an object which is an
instance of that class. That object will have its own state, and access to all of
the behaviors defined by its class.
n State (instance variables) Each object (instance of a class) will have its
own unique set of instance variables as defined in the class. Collectively, the
values assigned to an object's instance variables make up the object's state.
n Behavior (methods)