Lumenary CS · Programming languages
Java
Modern Java on JDK 25, from a first program to records, pattern matching, virtual threads and the tools professionals use every day.
Java is a statically typed, object-oriented language that compiles to bytecode for the Java Virtual Machine, so one program runs on any operating system and processor. Since 1995 it has become one of the most widely used languages in the world: it runs the back ends of banks, airlines and online shops, much of the big-data ecosystem, and countless enterprise and Android applications. Modern Java (records, sealed types, pattern matching, streams and virtual threads) is far more concise than its old reputation suggests.
This course is for anyone who can already write a small program with variables, decisions and loops, at the level of the Start level of Lumenary CS or equivalent experience. It takes you from installing the JDK and running a first program, through the core language and its type system, to collections and streams, data-oriented programming, exceptions, concurrency, the JVM's garbage collectors and JIT compiler, and the build and test tools of professional teams, ending with a complete small project.
To run the code, install a JDK, version 25 or newer: free builds are available from jdk.java.net and Eclipse Temurin. For short snippets with nothing installed, use the official Java Playground. Every complete program in these lessons was compiled and run on JDK 25 with java Main.java.
- Chloe · The Designer
“Why is the language built this way?” - Margaret · The Profiler
“What does it print, and what does it cost?” - Gideon · The Language Lawyer
“What exactly does the language guarantee?”
Foundations · 4 lessons
Foundations
The JDK and the JVM, Java's types and control flow, methods, classes and objects, and the interfaces and generics that hold large programs together.
- 1First steps: the JDK, the JVM and a first programWhere Java came from, what happens between a source file and a running program, and how to run your first one. 50 min
- 2Types, operators and control flowJava's eight primitive types, the arithmetic traps every professional knows, and the statements and expressions that decide and repeat. 55 min
- 3Methods, classes and objectsNaming behaviour with methods, bundling state and behaviour into classes, and what a variable that "holds an object" really holds. 55 min
- 4Interfaces, inheritance and genericsProgramming to what things can do rather than what they are, and writing code that works for many types without giving up type safety. 60 min
Practice · 3 lessons
Practice
Everyday Java as professionals write it: collections and streams, records, sealed types and pattern matching, exceptions, equality and immutability.
- 5Collections and streamsLists, sets, maps and queues from the standard library, how to choose between them, and stream pipelines for transforming data. 60 min
- 6Records, sealed types and pattern matchingModelling data as plain, immutable values with a fixed set of shapes, and letting the compiler check that every shape is handled. 60 min
- 7Exceptions, equality and immutabilityHow Java reports failure and cleans up after it, what it means for two objects to be equal, and why the best objects never change. 60 min
Professional · 3 lessons
Professional
Concurrency with executors, futures and virtual threads, how the JVM manages memory and compiles hot code, and the build, test and project practices of Java teams.
- 8Concurrency: threads, executors, futures and virtual threadsDoing many things at once safely, from locks and atomics to virtual threads, CompletableFuture and the structured concurrency preview of JDK 25. 65 min
- 9Inside the JVM: memory, garbage collection and the JITWhere objects live, how the garbage collector finds the ones you no longer need, and how hot code becomes fast machine code while the program runs. 60 min
- 10Build tools, testing and a complete projectHow Java teams build, test and ship code with Maven, Gradle and JUnit, and a complete small program written in idiomatic modern Java. 70 min
Further reading and resources
- dev.java · OracleThe Java team's site for developers: tutorials, news and the Java Playground.
- Java SE 25 documentation · OracleTool references, guides and the API documentation of the standard library.
- Java Language and Virtual Machine Specifications · OracleThe Java Language Specification and the JVM Specification for every release.
- Java Playground · OracleRun Java snippets in the browser.
- OpenJDKWhere the JDK is developed in the open, with the index of JDK Enhancement Proposals (JEPs).