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 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!");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?");
}
}Every statement in Java must end with a semicolon.
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.
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.
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 →