Skip to content
iamnoobs

Beginner to advanced · 13 modules · 39 lessons

Learn Java: Beginner to Advanced

Learn Java from the fundamentals through object-oriented design, collections, exceptions, files, modern functional features, concurrency, testing, and project design with concise lessons, guided examples, quizzes, and a capstone.

Who this is for: Beginners and developers preparing to build maintainable Java applications, backend services, automation tools, or Android-adjacent foundations.

Prerequisites: No previous Java experience is required. Examples use broadly available modern Java syntax, with newer features such as records and switch expressions noted where relevant. Code examples are educational and are not compiled or executed on this website.

Meet Java and the JVM

Java, the JDK, and the JVM

Java source is compiled to bytecode that runs on a Java Virtual Machine.

Java is a statically typed, class-based language. Developers typically write source files ending in .java; the Java compiler produces .class bytecode that a compatible JVM can execute.

The JDK includes development tools such as javac and java. The JVM executes bytecode, while the broader Java platform supplies standard libraries and runtime services.

Guided example

Read through this example; code examples are for learning and are not executed on this site.

// Save as Main.java
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, Java!");
    }
}

// Compile and run:
// javac Main.java
// java Main

Relevance quest · +10 XP

Which tool compiles a .java source file into bytecode?

Choose your answer

Mark this lesson complete when you are ready.

Module checkpoint: Meet Java and the JVM

Practice this module by writing a small Java program using meet java and the jvm. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

After this module, you can:

  • Distinguish the JDK, JVM, and Java compiler.
  • Create and run a small Java application.
  • Read basic compiler messages and console output.

Full curriculum

What you will learn

1. Meet Java and the JVM

Beginner

Understand Java source code, the JDK, compilation, and the edit-compile-run workflow.

  1. Java, the JDK, and the JVM

    Java source is compiled to bytecode that runs on a Java Virtual Machine.

  2. The shape of a Java program

    A class groups code, and main is a common application entry point.

  3. Variables and console output

    Variables name values, and print methods display information for debugging or users.

Module checkpoint: Practice this module by writing a small Java program using meet java and the jvm. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

2. Types, variables, and expressions

Beginner

Work with Java primitive types, reference variables, conversions, and constants.

  1. Primitive data types

    Java primitives represent simple numeric, character, and boolean values.

  2. Reference types and strings

    Reference variables can refer to objects such as String instances.

  3. Constants and type conversion

    final marks a variable as assignable only once after initialization.

Module checkpoint: Practice this module by writing a small Java program using types, variables, and expressions. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

3. Operators and decisions

Beginner

Use arithmetic, comparisons, logical operators, conditionals, and switch expressions.

  1. Arithmetic and comparison operators

    Operators compute values or compare them to produce a boolean result.

  2. if, else, and boolean logic

    Conditional branches execute only when their boolean condition is satisfied.

  3. switch statements and expressions

    switch selects among cases based on the value of an expression.

Module checkpoint: Practice this module by writing a small Java program using operators and decisions. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

4. Loops and iteration

Beginner

Repeat operations with for, while, do-while, nested loops, and safe loop control.

  1. for loops

    A for loop groups initialization, a continuation test, and an update.

  2. while and do-while

    while tests before running; do-while tests after running the body.

  3. Nested loops and loop control

    Nested loops process combinations, while break and continue alter iteration flow.

Module checkpoint: Practice this module by writing a small Java program using loops and iteration. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

5. Methods, parameters, and scope

Beginner

Design reusable methods, pass arguments, return values, and understand scope and overloading.

  1. Declaring and calling methods

    Methods package reusable behavior behind a name and a defined parameter list.

  2. Parameters and pass-by-value

    Java passes arguments by value, including copies of object references.

  3. Scope and method overloading

    Scope determines where a name can be used, and overloading provides related method signatures.

Module checkpoint: Practice this module by writing a small Java program using methods, parameters, and scope. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

6. Arrays, strings, and data handling

Beginner

Store ordered data, use multidimensional arrays, and work safely with String operations.

  1. Arrays and array traversal

    An array stores a fixed number of elements of one declared type.

  2. Multidimensional arrays

    A two-dimensional array is an array whose elements are themselves arrays.

  3. String operations

    String provides methods for searching, extracting, comparing, and transforming text.

Module checkpoint: Practice this module by writing a small Java program using arrays, strings, and data handling. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

7. Object-oriented programming

Intermediate

Model domain concepts with classes, objects, constructors, encapsulation, and records.

  1. Classes and objects

    A class defines a type; an object is an instance of that type.

  2. Constructors and encapsulation

    Constructors initialize objects, while access modifiers control visibility.

  3. Records, enums, and data modeling

    Records and enums provide concise ways to represent structured data and fixed choices.

Module checkpoint: Practice this module by writing a small Java program using object-oriented programming. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

8. Inheritance, interfaces, and polymorphism

Intermediate

Build extensible designs using inheritance, interfaces, overriding, and composition.

  1. Inheritance and overriding

    Inheritance lets a subclass specialize behavior inherited from a superclass.

  2. Interfaces and abstract classes

    Interfaces define contracts; abstract classes can share partial implementation and state.

  3. Polymorphism and composition

    Polymorphism lets code use a common type while runtime objects supply specialized behavior.

Module checkpoint: Practice this module by writing a small Java program using inheritance, interfaces, and polymorphism. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

9. Collections and generics

Intermediate

Choose collection types, work with generics, and compare elements safely.

  1. Lists, sets, and maps

    The Collections Framework provides reusable data structures for common operations.

  2. Generics and type safety

    Generics let collections and classes express element types at compile time.

  3. Equality, sorting, and iterators

    Consistent equality and ordering rules make collection behavior predictable.

Module checkpoint: Practice this module by writing a small Java program using collections and generics. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

10. Exceptions and input/output

Intermediate

Handle failures intentionally and work with console input, files, and resource lifetimes.

  1. Exceptions and error handling

    Exceptions report abnormal conditions and allow a program to handle or propagate failures.

  2. Console input and validation

    Input validation checks whether external values meet the program’s expectations.

  3. File I/O and try-with-resources

    Java provides stream and NIO APIs for working with files and other I/O resources.

Module checkpoint: Practice this module by writing a small Java program using exceptions and input/output. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

11. Lambdas, streams, and modern Java

Advanced

Use functional interfaces, lambda expressions, method references, streams, and Optional thoughtfully.

  1. Lambdas and functional interfaces

    A lambda expression provides an implementation for a functional interface.

  2. Streams and collectors

    Streams process data through pipeline operations such as filter, map, and collect.

  3. Optional and functional style

    Optional makes the possible absence of a returned value explicit.

Module checkpoint: Practice this module by writing a small Java program using lambdas, streams, and modern java. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

12. Concurrency and asynchronous work

Advanced

Learn threads, executors, synchronization, concurrent collections, and CompletableFuture basics.

  1. Threads and tasks

    A thread is an execution path, while a task is work that can be scheduled.

  2. Executors and futures

    Executors manage task execution, while futures represent results that may arrive later.

  3. Shared state and synchronization

    Synchronization coordinates access to shared mutable state between threads.

Module checkpoint: Practice this module by writing a small Java program using concurrency and asynchronous work. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

13. Testing, build tools, and application design

Advanced

Structure projects, write tests, use build tools, understand packages and debugging, and deliver a maintainable application.

  1. Packages and project structure

    Packages organize related types and help avoid naming conflicts.

  2. Unit testing and debugging

    Tests verify behavior, while debugging and logging help explain failures.

  3. Build tools and release readiness

    Build tools automate compiling, testing, dependency management, and packaging.

Module checkpoint: Practice this module by writing a small Java program using testing, build tools, and application design. Test a normal case, a boundary case, and an invalid or unexpected input; explain why the result is correct.

Put it together

Java capstone: Personal study tracker

Build a command-line study tracker that records learning sessions, topics, durations, and dates. Apply classes or records to model data, collections to manage entries, validation to protect data quality, file I/O to save and reload sessions, and tests to verify important behavior.

  1. 1Define a StudySession model with topic, date, and duration; validate required fields and non-negative duration.
  2. 2Create a menu that adds, lists, searches, and removes sessions using focused methods and clear input validation.
  3. 3Store sessions in a suitable collection and calculate total study time and totals grouped by topic.
  4. 4Add save and load functionality with explicit file paths, error handling, and a documented data format.
  5. 5Write tests for empty data, invalid input, zero duration, missing files, duplicate records, and summary calculations; document build and run instructions.

Progress is saved in this browser when local storage is available. You can continue without an account; changing browsers or clearing browser data may remove saved progress. Examples are not executed by the site.