Java Reference
In-Depth Information
Figure 1.7
A class and its
objects with fields
and values
Circle
LQWGLDPHWHU
LQW[3RVLWLRQ
LQW\3RVLWLRQ
6WULQJFRORU
ERROHDQLV9LVLEOH
LVLQVWDQFHRI
LVLQVWDQFHRI
FLUFOH&LUFOH
FLUFOH&LUFOH
GLDPHWHU
GLDPHWHU
[3RVLWLRQ
[3RVLWLRQ
\3RVLWLRQ
\3RVLWLRQ
FRORU
µEOXH¶
FRORU
µUHG¶
LV9LVLEOH
WUXH
LV9LVLEOH
WUXH
Figure 1.8
Two images created
from a set of shape
objects
1.9
Java code
When we program in Java, we essentially write down instructions to invoke methods on
objects, just as we have done with our figure objects above. However, we do not do this
interactively by choosing methods from a menu with the mouse, but instead write the com-
mands down in textual form. We can see what those commands look like in text form by
using the BlueJ Terminal.
 
 
Search WWH ::




Custom Search