1. Technology

Creating Your First Java Program


3 of 9

Save the File
Save the File

Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.

Save your program file as "HelloWorld.java". I’ve created a directory in My Documents called "Java" to store all the example Java programs in one place. It makes it easy for me to find them when I need them. You might consider creating a similar directory on your computer.

It’s very important that you save the text file as "HelloWorld.java". Java is a little bit picky about filenames. If you look at the code you will see the statement:

class HelloWorld{

It’s an instruction to call the class "HelloWorld". The filename must match this class name, hence the name "HelloWorld.java". The extension of ".java" tells the computer that it’s a Java code file.

  1. About.com
  2. Technology
  3. Java
  4. Getting Started
  5. Save the File

©2014 About.com. All rights reserved.