Introduction to Java

Work through these slides. As you read, think about and answer the questions at the bottom of each page. These will be your first experience with Java, so make sure you follow each step closely.

7. Creating a Java Source Program



Creating a Java Source Program

If you have already figured out how to create, compile and run Java programs on your computer, you can skip the rest of this chapter.

We will use the Notepad editor that comes with Microsoft Windows operating systems. Notepad is simple to use and good for getting started. After you see how things work using Notepad, move on to a better text editor (such as Crimson or Notepad++) or to a Java integrated development environment (IDE) (such as BlueJ or Dr. Java). For now, our goal is to create a text file called containing the text at right. We want to save the file in a folder (subdirectory) and to start a command prompt window in the same folder.


  1. Start a command prompt window (DOS window) in a folder.
  2. Create the source file
  3. Save the source file in the same folder.
  4. Compile the source file to create the file of bytecodes Hello.class in the folder.
  5. Run the bytecode file.
The following few pages show all this done on a particular Windows 7 computer. The Java Development Kit JDK has already been installed on this computer. It is almost certain that your computer will be different, but hopefully not too different.

Windows 7: To start, LEFT click the "start" icon at the lower left of your screen.

Windows 8: To start, RIGHT click the "window" icon at the lower left of your screen.

class Hello
      public static void main ( String[] args )
      System.out.println("Hello World!");



Question 7:

Will you see exactly the same things as above on your computer system?