Free through lesson 3

Java for Beginners

From how the JVM works through types, control structures, arrays, methods, object orientation, exceptions, collections, lambdas and streams. Fifty lessons that take you to the point where you can assemble a to-do app that saves to a file entirely on your own. Every piece of code and result shown was produced by actually running OpenJDK 21.

Curriculum

The 50 lessons are grouped into seven chapters. Working through them in order is the best way, but you are welcome to dip into whatever interests you. Note: this cannot run inside the browser, so try it with your own JDK 21 using javac and java.

Chapter 1 — Getting started (lessons 1–6)

You get to grips with how Java runs, install the JDK, and get to the point of running it yourself. You go as far as variables, primitive types and type conversion.

Chapter 2 — Values and strings (lessons 7–12)

You cover operators, constants and String. You learn why you must not compare with ==, and how to read input from the keyboard.

Chapter 3 — Control structures (lessons 13–18)

You cover conditionals and repetition: the order of your else if branches, switch expressions, how to avoid infinite loops, and break and continue.

Chapter 4 — Arrays and methods (lessons 19–25)

You handle groups of values of the same type and split work up by giving it a name. You finish by assembling a complete grade-tallying program.

Chapter 5 — Classes and objects (lessons 26–33)

The doorway into object orientation. Blueprints and instances, this, constructors, encapsulation, static, packages, and on to inheritance.

Chapter 6 — Abstraction and exceptions (lessons 34–41)

You gather behaviour with abstract classes and interfaces, and tidy your types with record and enum. Finally you cover how to throw and catch exceptions.

Chapter 7 — Collections and functional style (lessons 42–50)

List, Map and Set with generics, lambdas and streams, Optional, and file I/O. You finish by building a to-do app that saves to a file.

Once you have finished all 50 lessons, build for the web in the same language with Spring Boot for Beginners, or start from how servlets work in JSP & Servlets for Beginners. Membership unlocks every course.