Hello World

Print "Hello, World!" on the console using Java.

BeginnerTopic: Module 1: Basic Java Programs
Back

Java Hello World Program

This program helps you to learn the fundamental structure and syntax of Java programming.

Try This Code
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
Output
Hello, World!

Understanding Hello World

This is the first program most Java developers write. It shows:

How to declare a public class
How to define the main entry method
How to print text to the console using System.out.println

Note: To write and run Java programs, you need to set up the local environment on your computer. Refer to the complete article Setting up Java Development Environment. If you do not want to set up the local environment on your computer, you can also use online IDE to write and run your Java programs.

Table of Contents