Skip to content
KodeTrail

Camp 1 · Step 2 of 13

Hello, World!

Run your first Java program and decode the famous public-static-void-main ceremony, one word at a time.

12 min+50 XP

Every Java program you'll ever read starts with the same incantation. Let's run it, then translate it word by word.

Run it first

JavaCloud run

(This playground compiles and runs real Java in a cloud sandbox — the first run can take a few seconds.)

The translation

PieceMeaning
public class Main"Here is a class named Main" — all Java code lives in classes
publicvisible from outside
staticbelongs to the class itself, no object needed
voidthis method returns nothing
main(String[] args)the entry point — where every Java program begins
System.out.println(...)print a line to the console

You don't need to fully absorb static yet — for now, the honest summary is: main is the front door, and the JVM knocks on exactly this signature.

The three unbreakable rules

  1. Statements end with ;
  2. Blocks are wrapped in { }
  3. The file's class name matches the file name (MainMain.java)

Miss a semicolon and the compiler stops you with the exact line — try deleting one above and running.

Checkpoint

Where does a Java program begin executing?

Checkpoint

What happens if you forget a semicolon at the end of a statement?

What's next

What actually happens between your .java file and output on the screen — the compile-and-run pipeline.