Java
Learn Java by extending the file, process, test, and debugging model you already built. Each chapter adds one value, object, resource, concurrency, or adapter relationship, produces exact evidence, and names the stronger claim that remains unproved.
Your first Java 11 program: source, compiler, class, and output
Objective Save one complete Java source file, compile it under strict Java 11 diagnostics, run the class, and compare exact evidence.
Core explanation
A Java source file is plain text. In this chapter javac reads Main.java under the Java 11 release contract and either reports a diagnostic or creates Main.class bytecode. The java launcher then starts a JVM, loads Main, finds its public static void main entry method, and executes it. The source file, compiler, class file, launcher, JVM process, standard output, and exit status are different objects. Run javac -version and java -version first and stop if either command is unavailable or cannot support --release 11. Save the example with a final newline, compile it with javac --release 11 -Xlint:all -Werror Main.java, and run java Main. The program prints the first evidence line; the terminal supplies exit=0 immediately afterward. This run does not prove packages, JARs, modules, build tools, records, sealed types, virtual threads, tests, JDBC, Spring, another JDK, or production operation.
Reuse the first source-to-process evidence loop
You already know source text, a compiler, an executable artifact, a process, standard output, and exit status. Java adds one visible distinction: javac compiles Main.java into Main.class bytecode, and the java launcher starts a JVM that loads and executes that class. Main.java, javac, Main.class, java, the JVM process, the printed line, and the terminal status are separate objects.
Begin in an owned disposable folder. Run javac -version and java -version and retain both results. The required command uses --release 11 so the compiler checks Java 11 language and standard-library compatibility rather than silently compiling against whichever newer API happens to be installed. If either command is missing or --release 11 is rejected, stop instead of claiming a run.
Read the class and main method before learning packages
public final class Main declares one class whose public name must match Main.java. final prevents subclasses, and the private constructor prevents accidental Main instances because this class is only an entry container. public static void main(String[] args) is the entry signature the launcher searches for. static means the JVM does not need to construct Main first.
Inside main, int completed = 1 creates one primitive integer value. System.out.println formats literal text plus that value and writes one line to standard output. This chapter has no package, import, classpath, module, dependency, record, thread, framework, or server. Those concepts wait until the learner has a working source-to-class loop.
Compile, launch, and compare two evidence sources
Save the complete example with a final newline and run javac --release 11 -Xlint:all -Werror Main.java. --release 11 selects the compatibility target, -Xlint:all requests supported diagnostics, and -Werror rejects warnings. A successful command creates Main.class in the current folder; it does not run the program.
Run java Main only after compilation succeeds. The program must print language=Java release=11 completed=1. Immediately inspect the terminal status and record exit=0 separately because Main does not print it. If a compile fails but java Main still runs, that output can belong to an older Main.class and is not evidence for the edited source.
Laboratory: expose and recover from a stale class file
Change completed to 2, predict the exact output, compile, run, and compare. Then remove one semicolon and compile again. Predict that no new class file is justified. Run java Main deliberately and explain why any surviving output is stale. Restore the semicolon, rebuild, and reproduce the original line plus exit=0.
Repeat in a fresh disposable folder using only Main.java and the documented commands. Another learner must identify every artifact, explain why the class name and filename agree, and reproduce both evidence lines without an IDE, package, Maven, Gradle, JUnit, network, administrator access, or private instruction.