Source Code
A free lesson from Swipe Coding · Java, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
When you write a Java program, you type text into a file — for example Main.java. This human-readable text is called "source code". It consists of words and symbols that follow strict, well-defined rules, but is still readable to you.
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}A computer, however, cannot execute this text directly. A processor only understands "machine language" — tiny electrical signals represented as zeros and ones. Source code is therefore an intermediate stage: understandable for humans, but not yet directly executable by the hardware.
A computer processor can execute Java source code directly, without translating it first.
Java source code is always saved in files with the extension ".java". The file name must match the name of the public class inside the file — so the file for our example above would need to be called "Main.java", because the class is named "Main".
Java source code files always have the file extension ____.
In summary: source code is the starting point of every Java program. It is the text that you, as a developer, write, read, and edit yourself. Later — with the help of another tool — this text becomes something the computer can actually execute. You will learn about this tool in the next lesson.
What best describes "source code"?
The file name of a Java source code file must match the name of the public class it contains.
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 →