JavaBook
Free · Open · Made for learners

Learn Java,
one chapter at a time.

A calm, book-style course with clear notes, runnable code and diagrams — from your first Hello, World to the JVM internals. Built for students and teachers.

51
chapters available
51
in the full course
7
parts

Java Foundations

Syntax, data, control flow and the building blocks of every program.

01Introduction to JavaBuild a strong mental model of what Java is, why it was created, how Java programs run, why Java is called platform-independent, and where Java fits in the software world.02Setup & Your First Java ProgramSet up a proper Java development environment, understand the JDK, learn the java and javac commands, create your first Java program, compile it, run it, understand the basic structure of the program, and learn how…03Variables & Data TypesUnderstand how Java stores and works with data. By the end, you should be comfortable creating variables, choosing the correct data type, assigning values, reading values, performing basic conversions, and…04Operators & ExpressionsLearn how Java performs calculations, comparisons, assignments, logical operations, and other transformations on values. Operators are the tools that let a program actually do something with the variables you learned…05Input & Output in JavaIn this chapter, we learn how a Java program communicates with the outside world: how it displays information on the screen and how it accepts information from the user.06Conditions in JavaConditions allow a Java program to make decisions. Instead of always executing the same code, a program can check a condition and choose what to do.07Loops in JavaLoops allow a Java program to repeat a block of code. They are one of the most important concepts in programming because many problems require the same operation to be performed multiple times.08Methods in JavaMethods are one of the most important building blocks of Java programs. A method lets us give a name to a piece of work, reuse that work, organize a large program into smaller parts, and make code easier to…09Arrays in JavaAn array is one of the first important data structures you learn in Java. It allows you to store multiple values under one variable name and access those values using indexes.10Strings in JavaStrings are one of the most important parts of Java. Almost every real application works with text: names, messages, passwords, emails, URLs, file paths, JSON, commands, database values, and user input.

Java Interview & Practice

Use these prompts after the course to review concepts, explain your thinking, and practise problem solving.

Open Chapter 51 →
Q01What is the difference between a class and an object?
Q02When would you choose an interface over an abstract class?
Q03How does HashMap find and store a value?
Q04What is the difference between == and equals()?
Q05Explain the Java thread lifecycle and the difference between start() and run().
Q06What is the difference between heap memory and stack memory?
Q07How does garbage collection work, and what can cause a memory leak?
Q08Solve a collection or string problem and explain its time complexity.