Skip to content

Metadata Card

  • Prerequisites: Vol 0 (or basic terminal/IDE usage)
  • Estimated time: 30 min
  • Core difficulty:
  • Reading mode: Easy stroll
  • Completion marker: Can write, compile, and run a Java program from scratch

Your Progress

This is it. The moment you've been building toward. The terminal is open, Git is installed, your IDE is ready. Now: the first spark.

Your Task

No long intro. No philosophy. Open your editor. Write code. Run it.

The Breakthrough · Tracing the Origins

Act 1: The First Spark

This is where every programmer starts. There is a tradition — a brief incantation that, when spoken, wakes up the machine and announces your presence.

java
public class HelloWorld {
 public static void main(String[] args) {
 System.out.println("Hello, World!");
 }
}

Language: Java 17+ How to run: Save as HelloWorld.java, then:

bash
javac HelloWorld.java  # Compile
java HelloWorld        # Run

Expected output: Hello, World!Try it: Change "Hello, World!" to your own name, compile and run again

What just happened?

You told the computer to print text to the screen. This is the simplest meaningful interaction between human and machine.

What each line means (don't worry if this is fuzzy — it will crystallize):

  • public class HelloWorld — defines a "class" named HelloWorld. In Java, everything lives inside classes.
  • public static void main(String[] args) — the entry point. When Java runs, it looks for this exact method to start executing.
  • System.out.println(...) — a built-in command that prints text to the console.

You don't need to memorize this. You'll write variations of it hundreds of times. It will become muscle memory.

Cross-language window

Python:

python
print("Hello, World!")

One line. Python is interpreted — no separate compile step.

C++:

cpp
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}

More ceremony than Java. C++ also compiles: g++ hello.cpp -o hello && ./hello

Act 2: What You Actually Did

StepWhat happened
javac HelloWorld.javaThe compiler read your human-readable source code and translated it into bytecode (HelloWorld.class) — instructions the Java Virtual Machine (JVM) can understand
java HelloWorldThe JVM loaded the bytecode, interpreted/compiled it to machine code, and executed it

Source code → Compiler → Bytecode → JVM → Machine code → Running

The result: Hello, World! appears on your screen. You wrote a program.

Traveler's Notes

The first program is always HelloWorld. It's a tradition. Say hello to the machine, and the machine says hello back.
javac compiles. java runs. Every language has these two phases — the words may differ, the concept is the same.

Next

You said hello. Now let's see how the machine stores information. Variables and types — the memory cells of your program.

Built with VitePress | Software Systems Atlas