1. Home
  2. Computing & Technology
  3. Java

Creating Your First Java Program

By , About.com Guide

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.

Explore Java
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Java
  4. Getting Started
  5. Save the File

©2009 About.com, a part of The New York Times Company.

All rights reserved.