Java Reference
In-Depth Information
2. Make two files, one for each class.
3. Compile both files.
4. Run the test program.
Many students are surprised that such a simple program contains two classes.
However, this is normal. The two classes have entirely different purposes. The
Bank-Account class describes objects that compute bank balances. The
BankAccountTester class runs a test that puts a BankAccount object through
its paces.
103
104
S ELF C HECK
11. When you run the BankAccountTester program, how many objects
of class BankAccount are constructed? How many objects of type
BankAccountTester?
12. Why is the BankAccountTester class unnecessary in development
environments that allow interactive testing, such as BlueJ?
P RODUCTIVITY H INT 3.2: Using the Command Line
Effectively
If your programming environment allows you to accomplish all routine tasks using
menus and dialog boxes, you can skip this note. However, if you must invoke the
editor, the compiler, the linker, and the program to test manually, then it is well
worth learning about command line editing.
Most operating systems (including Linux, Mac OS X, UNIX, and Windows) have
a command line interface to interact with the computer. (In Windows XP, you can
get a command line window by selecting ȒRun șȓ from the Start menu and typing
cmd .) You launch commands at a prompt. The command is executed, and on
completion you get another prompt.
When you develop a program, you find yourself executing the same commands
over and over. Wouldn't it be nice if you didn't have to type commands, such as
javac MyProg.java
Search WWH ::




Custom Search