Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Java Program Structure · Lesson 13 of 28

Statements

A free lesson from Swipe Coding · Java, level 1 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
A semicolon is Java's way of saying 'done with this thought.' ✅

A Java program consists of many small statements. A statement is a single instruction to the computer — for example "print this text". Every statement ends with a semicolon ";".

System.out.println("Hello, Java!");
This is a single statement. It ends with a semicolon — the character that tells Java "done".
🤖
Forget this tiny character and the compiler gets confused fast. ⚠️

The semicolon works like a period at the end of a sentence: it tells the compiler "this statement is complete, the next one follows". If you forget the semicolon, the compiler doesn't understand where a statement ends and reports an error.

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello!");
        System.out.println("How are you?");
    }
}
Here are two statements in a row. Java executes the first one first, then the second — in exactly that order.
True or false

Every statement in Java must end with a semicolon.

🤖
No shortcuts yet — Java just runs your code top to bottom. ➡️

At its core, a Java program is nothing more than a sequence of such statements. The JVM processes them strictly in order — from top to bottom, one after another. At this point there are no "shortcuts" or jumps yet — it's purely step-by-step execution.

Quick check

Which character marks the end of a statement in Java?

Statements don't just float around freely — they always sit inside a block enclosed by curly braces { }, for example the block of the main() method. We'll see exactly how these blocks work in the next lesson.

Fill in the blank

Java executes a program's statements in order, from ____ to bottom.

Keep your streak going in Swipe Coding

Swipe through every level of Java on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →