Java

Basic Java Class 2: First Java Program and Print Hello World



Steps to Compile and Run first Java program
Step 1) Open Notepad from Start menu by selecting Programs – Accessories – Notepad.

Step 2) Create a Source Code for your Program

Declare a class with name HelloWorld.
Declare the main method public static void main(String args[]){
Now Type the System.out.println(“Hello World”); which displays the text Hello World.
class HelloWorld {
public static void main(String args[]){
System.out.println(“Hello World”);
}
}

Step 3) Save the file as…

Leave a Reply

Your email address will not be published. Required fields are marked *