Home Java Hello World Program

Java Hello World Program

Beginner ⏱ 5 min read Updated: Jul 2026
  • The Hello World program is the first program beginners learn in Java.
  • It helps understand the basic structure of a Java program.
  • Java uses System.out.println() to display output.
  • Every Java program starts execution from the main() method.

What is Java Hello World Program?

The Hello World program in Java is a simple program that displays "Hello World" on the screen. It is commonly used as the first example to learn Java programming.

This program helps beginners understand Java syntax, class structure, and how Java executes code.

Simple Java Hello World Example

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

Explanation of Java Hello World Program

class Main

The class keyword creates a class in Java. Main is the name of the class containing the program.

main() Method

The main method is the starting point of Java program execution. JVM starts running the program from this method.

System.out.println()

This method is used to print text or values on the console.

How Java Hello World Program Works?

  • Java code is written inside a .java file.
  • The compiler converts Java code into bytecode.
  • JVM executes the bytecode.
  • The output is displayed on the screen.

Compile and Run Java Program

Commands
javac Main.java
java Main

Why Learn Hello World Program in Java?

Learning the Hello World program helps beginners understand basic Java syntax and program execution.

Key Point: Java programs are executed using JVM, which allows Java applications to run on different platforms.

Key Points to Remember

  • Every Java program contains a class.
  • Execution starts from the main() method.
  • System.out.println() prints output.
  • Java uses JVM to run programs.