revised 01/18/99; 01/29/2000

CHAPTER 7 — Running Example Programs

These chapters have many example Java programs. You will need to run them and play with them. There is probably no more effective way to learn programming than to fiddle with example programs.

You don't have to type the programs to run them. If you see the program in a browser window, then you can easily copy it to Notepad (or other editor). First highlight the code by clicking in the window and dragging the mouse over it. Then click Edit and then Copy in the browser's menu. Finally click Edit and then Paste in Notepad. Now Notepad has a copy of the program. Save the copy to a file, compile it, and run.

If this is perfectly clear to you then you can skip this chapter. If not, this chapter walks you through these steps.

Chapter Topics:

Notes:

1. The steps are shown for a computer running Windows NT 4.0. Nearly the same steps can be used for other varieties of Windows. The software used in these notes is the minimum possible requirement. It is available for free on all Windows computers. Even if you have better software it is probably wise to start out using this minimum.

2. If you use a commercial Java programming environment (such as J++ or JBuilder) you can follow these steps by using your environment's editor rather than Notepad. But it may be faster to use Notepad. Most commercial environments assume you are setting up a big project and require many preliminary steps.

3. Rather than use Notepad, you can use Code-Genie. It is simple and easy to use and free, but it is a big improvement over Notepad. See www.code-genie.com.

4. A small, but free, Java programming environment such as BlueJ may be your best choice. You will have to make some adjustments as you follow these notes, however. See www.bluej.org.

QUESTION 1:

Is it sometimes benificial to type in a program rather than just copying it?