Java

A statically typed, object-oriented language for Android apps and large backend systems.

Java is a statically typed, object-oriented language used for Android apps, business backends and financial systems. It has been around since 1995, so it has a large ecosystem of libraries and mature tooling.

  • Intermediate
  • 13 lessons
Not started yet
Start lesson 1

Lessons

  1. Hello, World!Write and run your first Java program. You will see why even a small program needs a class and a main method, and how to compile and run it.
  2. Variables & TypesLearn how to declare variables and use Java's basic types. Java is strictly typed, so it checks that every value matches its declared type and asks for an explicit cast when a conversion could lose data.
  3. Control FlowLearn if/else, loops and switch in Java. If you know C or JavaScript this will look familiar, and the newer switch expression (Java 14+) makes many branches shorter.
  4. MethodsLearn how to write and call methods, Java's name for functions. In Java every method belongs to a class.
  5. Arrays & CollectionsLearn fixed-size arrays and the Collections framework (ArrayList, HashMap, HashSet), which you will use for most lists and lookups in real programs.
  6. Classes & OOPLearn how to define classes, create objects, and use constructors, inheritance and overriding. Classes are how almost all Java code is organised.
  7. Exception HandlingLearn how to catch and throw exceptions in Java, including checked exceptions, which the compiler requires you to either handle or declare.
  8. Mini Project: Simple BankBuild a small console banking app that puts together classes, collections, exceptions and user input.
  9. Interfaces, Abstract Classes & GenericsInterfaces describe what a type can do, and generics let one class or method work with many types while keeping compile-time checks. Both appear throughout the Java standard library.
  10. Lambdas & the Stream APILearn lambdas and the Stream API, which let you write many loops as a short pipeline of steps such as filter, map and collect.
  11. Threads, Executors & ConcurrencyLearn how to run work in parallel with threads, executors and Java 21 virtual threads, and how to share data between threads safely.
  12. Files, I/O & Modern Java FeaturesLearn to read and write files with java.nio.file, and use newer language features such as records, sealed types and pattern matching to keep code short.
  13. Java CheatsheetModern Java (17+) on one page — records, streams, collections.

Install it on your own computer

To write Java you need the JDK (Java Development Kit). Install JDK 21, the current long-term support release, then check it works with the commands below.

Bash
# Option 1: Adoptium (Eclipse Temurin — recommended open source)
# Download the .msi from adoptium.net — check "Set JAVA_HOME" option

# Option 2: winget
winget install EclipseAdoptium.Temurin.21.JDK

# Option 3: Oracle JDK from oracle.com

# Verify (in new terminal):
java --version
javac --version

What people build with Java

Learn the basics first, then pick up these tools when a project needs them.

Practical uses

  • Build enterprise backend systems
  • Develop Android applications
  • Run high-throughput data platforms
  • Create cross-platform desktop and server software

Projects to try

  1. CLI gradebook
  2. Spring Boot REST API
  3. Android habit tracker
  4. Event-driven order service

Common tools and packages

Spring BootMavenGradleJUnitHibernateJacksonMockitoQuarkus

Well-known software

IntelliJ IDEAMinecraftJenkinsElasticsearchApache KafkaGradle