Java Reference
In-Depth Information
S ELF C HECK
20. Suppose we had called box.translate(25, 15) instead of
box.translate(15, 25) . What are the expected outputs?
21. Why doesn't the MoveTester program need to print the width and
height of the rectangle?
22. The Random class is defined in the java.util package. What do you
need to do in order to use that class in your program?
A DVANCED T OPIC 2.1: Testing Classes in an Interactive
Environment
Some development environments are specifically designed to help students explore
objects without having to provide tester classes. These environments can be very
helpful for gaining insight into the behavior of objects, and for promoting
object-oriented thinking. The BlueJ environment (shown in Testing a Method Call
in BlueJ) displays objects as blobs on a workbench. Y ou can construct new objects,
put them on the workbench, invoke methods, and see the return values, all without
writing a line of code. You can download BlueJ at no charge from [ 1 ]. Another
excellent environment for interactively exploring objects is Dr. Java [ 2 ].
49
50
Testing a Method Call in BlueJ
Search WWH ::




Custom Search