Java

From your first program to a project with packages: variables, errors, loops and methods.

Each lesson has runnable examples and exercises. The Java compiler and runtime are real (OpenJDK 25), running in a small Linux machine inside this tab: no install, no server compiling for you. The first visit downloads about 35 MB, of which the first 8 MB before you can start; later visits start from your browser's copy.

Linux + OpenJDK 25 in your browser

6 lessons · 15 programs

  1. 1 Hello, Java

    Your first program, and the two commands that build and run it.

  2. 2 Variables and arithmetic

    Store numbers and text in variables, compute with them, and meet integer division.

  3. 3 Reading compiler errors

    What javac tells you when a program is wrong, and how to read a stack trace.

  4. 4 Decisions and loops

    if and else, for and while, and the classic FizzBuzz.

  5. 5 Methods and input

    Write your own methods, read input with Scanner, and split a program across files.

  6. 6 Packages and projects

    Split a program into packages and folders, and build the whole folder with one javac command.