Java Hello World in Eclipse

Introduction: Java Hello World in Eclipse

Here we will be assuming you already have the Eclise IDE.

Step 1: Create the Project

After you have opened Eclipse select file -> new -> Java Project. Once you select that, you will see something similar to the below picture show up.

Step 2: Name Your Project

Now that you have created the project, you have a chance to name it. Feel free to name it what you will.

Step 3: Create a New Package

Expand the package and right click on the src icon and make a new package. In here is where you will be putting the class.

Step 4: Create the Class

After you have made the project you will want to right click that project and navigate to make a new class. After that a window, similar to the one below, will open up. Select the option to have a main method made for you. What this will do once you hit finish is make a .java class that you can then begin to edit.

Step 5: Create a Variable

Just below public static void enter the following String statement = "Hello World"; What this does is create a variable of type String. What it currently has is Hello World in it, which can be altered as you wish.

Step 6: Enter the Statement

Just below public static void enter the following System.out.println();

Step 7: Enter the Variable

Get inside the parentheses and put statement. This will cause the program to print what is in the variable when you run it.

Step 8: Run the Program

Click the save icon and then the icon with the green circle with the play icon in it.

Step 9: Congratulations!

You just wrote and ran a Java program. Feel free to smile a little.

Step 10: Experiment

Now experiment with the print statement. A couple of fun variants you can use are print and printf in place of println.

Be the First to Share

    Recommendations

    • Space Contest

      Space Contest
    • Metal Contest

      Metal Contest
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge

    Comments