Java 21 — 8 Modules · 60+ Examples
Java from Basics to Threads.
The workhorse of enterprise software — statically typed, compiled to run anywhere on the JVM. Types and collections, OOP with all four pillars, generics, streams and lambdas, and real multi-threaded concurrency. Powers Android, backend services, and big data.
⬡Java 21 LTS
⬡60+ runnable examples
⬡OOP fully covered
⬡Real threads
8
Modules
Basics → Practice
60+
Examples
Runnable code snippets
4
OOP Pillars
All fully covered
40
Practice Programs
Basic → Advanced
Curriculum
All 8 Java modules
Follow the path top-to-bottom or jump to the module you need.
Module 01
Java Basics
PrimitivesvarStrings
Where every Java journey starts. The eight primitive types, var inference, wrapper classes, and immutable Strings.
Starter level
Learn →
Module 02
Control Flow
if/switchLoopsArrow switch
Conditionals, the modern switch expression, and every loop form including the for-each.
Starter level
Learn →
Module 03
Collections
ListMapGenerics
Arrays, ArrayList, HashMap, HashSet, and the generics that make the whole framework type-safe.
Starter level
Learn →
Module 04
Methods & Classes
OverloadingstaticConstructors
Typed methods, overloading, varargs, the static/instance split, and the constructors that build objects.
Mid level
Learn →
Module 05
Object-Oriented Programming
4 PillarsInterfacesRecords
The heart of Java. All four pillars, interfaces vs abstract classes, and modern records and enums.
Mid level
Learn →
Module 06
Exceptions & File I/O
try/catchCheckedFiles
Java's signature checked/unchecked exception model, try-with-resources, and reading and writing files safely.
Mid level
Learn →
Module 07
Streams & Lambdas
LambdasStream APIOptional
Functional Java — lambdas, method references, the Stream pipeline, and Optional to design out null bugs.
Advanced
Learn →
Module 08
Concurrency
ThreadsExecutorssynchronized
Real OS threads and true parallelism — ExecutorService, synchronized state, concurrent collections, and the classic pitfalls.
Advanced
Learn →
Module 09
Practice Programs
AlgorithmsOOPThreads
40 hands-on programs from basic to advanced — sorting, a generic stack, a bank account system, and a concurrent counter.
Advanced
Practice →
Why Java?
The language enterprise runs on
For Android, backend services, and big-data systems — Java is the safe, scalable, and hireable choice.
Enterprise Standard
Banks, insurers, and Fortune 500 backends run on Java. Decades of stability and a huge hiring market make it a safe career bet.
Android & Mobile
Java (alongside Kotlin, which runs on the same JVM) is the foundation of Android development — billions of devices.
Type-Safe & Robust
Static typing and checked exceptions catch whole classes of bugs at compile time — a big reason large teams trust Java at scale.
Write Once, Run Anywhere
Compile to JVM bytecode and it runs on any platform with a JVM — the promise that made Java ubiquitous.
Big Data & Backend
Spring, Hadoop, Kafka, and Elasticsearch are all Java. If you work with large-scale data or services, you'll meet it.
True Multithreading
Real OS threads and, since Java 21, lightweight virtual threads — genuine parallelism that single-threaded languages can't match.
Watch Out
Java gotchas that trip up interviews
Common surprises — know these cold before your next interview.
Code Preview
Taste the content
Three patterns from across the curriculum — click to switch.
Records
Streams
Inheritance
// A record — one line replaces a whole boilerplate class record Point(int x, int y) {} Point a = new Point(3, 4); Point b = new Point(3, 4); a.x(); // 3 — accessor generated a.equals(b); // true — value equality, free System.out.println(a); // Point[x=3, y=4] — toString, free
// Stream pipeline — filter, map, collect List<Integer> nums = List.of(1, 2, 3, 4, 5, 6); List<Integer> evenSquares = nums.stream() .filter(n -> n % 2 == 0) // [2, 4, 6] .map(n -> n * n) // [4, 16, 36] .collect(Collectors.toList()); int sum = nums.stream().mapToInt(Integer::intValue).sum(); // 21
// Inheritance with @Override and polymorphism class Animal { String speak() { return "..."; } } class Dog extends Animal { @Override String speak() { return "Woof"; } } Animal a = new Dog(); // parent-typed reference a.speak(); // "Woof" — runtime dispatch to Dog
Ready to test your knowledge?
Java interviews lean hard on OOP — the four pillars, interfaces vs abstract classes, and collections. Practice them in our OOP Interview bank alongside DSA and system design.