go to previous page   go to home page   go to next page        

Answer:

Yes. You want the source file Hello.java to be saved in the disk directory that is the default directory for the command prompt window.

Naming the File

The name of the source file should be the same as the name that follows the word class in the program (match upper and lower case), and should be given the extension .java (lower case). For example, our program contains the line:

class Hello

so the file name must be Hello.java. When you get to the Temp directory (or whatever default directory you are using):

  1. Type the file name into the box.
  2. The file name should be Hello.java
    • For some versions of Notepad you should put quote marks around the file name like this: "Hello.java" even though the quote marks will not be part of the file name.
    • Sometimes Notepad automatically uses the extension ".txt" and you may need to struggle to name the file what you want.
  3. Select "Save as all files" by clicking on the little down arrow it the box below the file name box.
  4. Select "Encoding: ANSI" in the bottom box.
  5. Click on "Save"

Your system is likely to be slightly different. Experiment with different choices until you are able to create a text file that contains the sample Java program.

Saving the File

Fussy, bothersome, irksome, irritating details. Yes, I know... Some people actually like this stuff. But if you can tie your shoes or drive a car you can do this. It might take some practice.

QUESTION 12:

So, finally your Java program source file is saved. What must you do to run it?