Java Hello World Program

In this post, we will learn how to print hello world using Java Programming language.

Hello, World! is one of the simplest programs used to understand the syntax of any new programming language.

So, without further ado, let’s begin this tutorial.

Java Hello World Program

// Java Program to Print Hello World 
public class HelloWorld{
    public static void main(String[] args){
        System.out.println("Hello, World!");
    }
}

Output

Hello, World!

How Does This Program Work ?

// Java Program to Print Hello World 

Comments are used to explain code, and to make it more easily readable. Comments are ignored by the java compiler. Single line comments start with two forward slashes(//) and multi line comments start with /* and end with */.

public class HelloWorld{
	. . . . . 
}

In Java every application begins with a class, and in this program HelloWorld is the name of the class.

    public static void main(String[] args){
		. . . .
	}

Every program in the Java programming language must contain a main method.

        System.out.println("Hello, World");

This statement prints the message inside the quotation marks on the screen.

Conclusion

I hope after going through this post, you understand how to print hello world using Java Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to help you.

Leave a Comment

Your email address will not be published.