In this tutorial the basic demonstration of creating a project in eclipse that will output the string on screen Hello World is given. You will learn adding classes to it and how will you save and compile the project to see output hello world in java.
Step 1: Creating a new project
It is very easy to create hello world in java program. Just create a new project. Just go to the files->new-> Java project.
Step 2: Giving project name
Give project a name and click finish.
Step 3: Adding classes
To write the code you need to add classes to the project. Right click on the SRC folder and go to new->Class.
Step 4: Selecting class options
Give a class name. Click on the check Public static void main (string args) if the class is the main class of the program. Main program of the class is the start point of execution of code. So in this scenario we will have only one class that is our main class. Click finish and open class.
Step 4: Writing code
Now its time to write the code for hello world in java . The code for printing the line to the screen is
System is the Java library containing various functions. “Out” is the print stream and “println” is the method that write a string to the console with a carriage return line field.
Step 5: Saving and Compiling
Save the program by pressing Ctrl+S and click on the run tab on the toolbar and run as Java Application.
Step 6: Showing the result
With that, you can see the output hello world in java program. The output of the program is displayed on the console. In this program we print a string on console.