Skip to content

Hello, World!

Read · 1 of 5

Every program has the same frame

A program is a list of instructions the computer follows one at a time, top to bottom.

In Java your instructions live inside main, which lives inside a class called Main. For now, treat the first two lines and the two closing } as a frame you copy every time: your code goes in the middle.

System.out.println(...) prints whatever is inside the brackets, then starts a new line. Every instruction ends with a semicolon ( ; ).

1public class Main {
2 public static void main(String[] args) {
3 System.out.println("Hello, World!");
4 }
5}