Hello, World! in Java

The traditional first program when learning a new programming language is to display the text "Hello, World!". In Java, you can achieve this with a simple program.

Hello, World! Program in Java

To print "Hello, World!" to the console in Java, you can use the following code:


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

Output: