Java Reference
In-Depth Information
Figure 1.2
An object on the
object bench
Convention We start names of classes with capital letters (such as Circle) and names of objects
with lowercase letters (such as circle1). This helps to distinguish what we are talking about.
Exercise 1.1 Create another circle. Then create a square.
You have just created your first object! “Circle,” the rectangular icon in Figure 1.1, represents
the class Circle ; circle1 is an object created from this class. The area at the bottom of the
screen where the object is shown is called the object bench.
1.3
Calling methods
Right-click on one of the circle objects (not the class!), and you will see a pop-up menu with
several operations (Figure 1.3). Choose makeVisible from the menu—this will draw a rep-
resentation of this circle in a separate window (Figure 1.4).
Figure 1.3
An object's pop-up
menu, listing its
operations
You will notice several other operations in the circle's menu. Try invoking moveRight and
moveDown a few times to move the circle closer to the center of the screen. You may also like
to try makeInvisible and makeVisible to hide and show the circle.
 
Search WWH ::




Custom Search