Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

How Java Works · Lesson 5 of 28

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

🤖
Source code is just text you write — Java turns it into something real. 📝

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!");
    }
}
This is source code. You can read and understand it, even if you don't know every detail yet.

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.

True or false

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".

Fill in the blank

Java source code files always have the file extension ____.

🤖
You've got the starting point down — next up, how it becomes runnable. ➡️

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.

Quick check

What best describes "source code"?

True or false

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 →