August 11, 2022•1 min read

Building a "Hello World" Program in Java

This time we build our first program, Hello World, in the Java language.

Read in Indonesian

After getting to know the Java language, the next step is the first program: "Hello World" in Java.

The program is simple, its goal is to print the text "Hello World" on the console screen. Let's get started.

Preparation

As preparation, go ahead and open Eclipse, Netbeans, IntelliJ, or another editor you like. If installing anything is too much trouble, an online editor such as JDoodle works too.

That's it, that's all we need. For how to create the program file and run the code, follow the steps of your editor or IDE.

If your device is limited but you still want to code Java, try VSCode. Installation and setup are covered here. Compared with an IDE like the ones above, VSCode is relatively lighter.

Hello World Code in Java

With the code editor open, start typing.

The code is called "Hello World". As the name suggests, it prints the text "Hello World" on the console screen.

Anyway, here is the "Hello World" code in Java. Type it in your editor — or copy-paste it, that's allowed too.

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

Run it, and the code produces output like this:

TEXT
Hello World!

Yayy.. your first Java code ran successfully👏

Next Up

Since this still counts as a warm-up, there's no need to worry about what the code means yet, we'll cover that next time.

Next up is the basic structure of Java code

Happy coding 👏

Get better at shipping code.

Join the other developers getting tech updates, tips, and relaxed tutorials in their inbox every week.

Stay in the loop

Tech updates, coding tips, and relaxed insights straight to your inbox every week.

No spam. Unsubscribe anytime.

Read next

See all

For developers who learn by struggling

© 2026 Inva.dev.