Running Example Programs

This chapter provides step-by-step instructions of writing a Java program using a text editor, and then compiling and running this program from command prompt. Several Integrated Development Environments (IDEs) are mentioned in this chapter. We have already installed NetBeans. That and Eclipse are the most popular in Java professional practice.

8. Step 6: Save the Source File


Use the "Save As" menu option.

Step 6: Save the Source File


Click on the "File" menu in the upper left of Notepad. Select "Save-as".

The first time you do this, Notepad will show you some other folder than the one you want. You will need to "navigate" to the same folder you chose in step 2.

Save the example program as

(Of course, other programs will be saved to other files.)


Warning (1): In some older versions of Notepad you must use quote marks around the name of the file. So in the above you would type "" (quotes included) into the File name box.

Warning (2): Some versions of Notepad require Save as type All Files.

Warning (3): Be sure that you pick Encoding ANSI.

Question 9:

Hopefully, the file has been saved to the folder C:\Temp, the same
one that the command prompt window is using. How can you confirm that this indeed happened?