← Learn
Learn · Java

Intermediate Java

Nine lessons on writing your own types and using Java’s toolbox: classes and objects, keeping data safe with private fields, inheritance, interfaces and abstract classes, lists, maps and sets, exceptions and stack traces, enums and records, generics and sorting with Comparable and Comparator, and a small library app with its JUnit tests.

Part of the Java developer path.

Take first: Java basics.

More info

How it works

Each lesson is a short read with Java examples and what each one prints. Then practice questions: say what a snippet prints (Java’s output exactly, capitals and all), pick an answer, tap lines of code or steps into order, or tap the line of an error message that gives the cause away. You can try again as often as you like; after two misses there’s a button to show the answer. To run an example yourself, save it as Main.java (adding the public class Main and main lines around it if it doesn’t have them, and import java.util.*; at the top for lists, maps and the other collections) and run java Main.java.

What do I need to know first?

The Java basics course, or the same ground elsewhere: variables, if and loops, arrays and writing methods. Every example that shows what it prints was compiled and run on Java 21.

Related courses

Where is my progress saved? In this browser, like the rest of the site. Nothing to sign up for.

Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates. This course isn’t made by or affiliated with Oracle. Library and tool names (Maven, Gradle, JUnit, Mockito, SLF4J, Logback, Log4j, Spring Boot) are used only to say what they are. Every shop, service, file and person in the examples is made up.