...
- Compile All: the
Rectangle
file is automatically saved and recompiled. - To create an instance of class
Rectangle
, type the following in the Interactions pane:
Note: the "Compile All" command resets the Interactions pane erasing all extantCode Block Rectangle r = newRectangle(4,5);
definitions of names bound to objects. So when we compiled our new definition for theRectangle
class,
we destroyed our first binding ofr
in the Interactions pane. - To "ask" the
Rectangle
object bound tor2
to compute its area, type
in the Interactions pane.Code Block r2.area();
- Experiment with the DrJava Interactions pane to create some new rectangles and computer their areas.
...