First-program-in Java .

In this session i have discussed hello world program in java .


Here we will know how to write the firt hello world java program .


There are two ways by which you can write the java program as follows .

1-By using command prompt

2-By using IDE (Integrated Development Environment like eclipse)


1-By using command prompt

First of all open the notepad and write the program like below . You need to save this file as Hello.java .

    class Hello{  
    public static void main(String args[]){  
     System.out.println("Hello World");  
     }  
    }  
    

To compile the program write the javac hello.java .

To execute the program write the hello on command prompt

    OUTPUT : Hello World
    

2-By using IDE

First of all you have need to download the eclipse .

Open the eclipse folder inside the eclipse click on eclipse.exe .

After clicking on eclipse it will open the eclipse launcher where select the drive where you want to save the program .

Click on file->new-project->java->java project .

After clicked on java project a create java project wizard will display write the project name and click on next button and then finish button

Your project displayed under project explorer . You need to explore the project and right click on src folder and click on new and then class . After click on class a dialog box will display where you need to give the class name and check the public static void main() .

After that write the below code in your given class .

    class ClassDemo{  
    public static void main(String args[]){  
     System.out.println("Hello World");  
     }  
    }  
    
    OUTPUT : Hello World
    

Welcome to AndroidATPoint.

back image                     next image