Author Archives: Tabitha Peck

Hello World

How do I write a simple “Hello World” program?

To write a “Hello World” program follow these steps:

  1. Start Eclipse.
  2. Create a new Java Project:
    1. File->New->New Java Project.
    2. Enter a project name into the Project name field, for example, “Hello World Project“.
    3. Click “Finish“–It will ask you if you want the Java perspective to open. (You do.)
  3. Create a new Java class:
    1. Click the “Create a Java Class” button in the toolbar. (this is the icon that looks the a green circle with a C in it with a tooltip that says “New Java Class.”)
    2. Enter “HelloWorld” into the Name field.
    3. Click the checkbox indicating that you would like Eclipse to create a “public static void main(String[] args)” method.
    4. Click “Finish“.
  4. A Java editor for HelloWorld.java will open. In the main method enter the following line.
         System.out.println("Hello World");
  5. Save using ctrl-s. This automatically compiles HelloWorld.java.
  6. Click the “Run” button in the toolbar (looks like a white triangle in a green circle). The console will open and display “Hello World“.