← All tutorials

Java Tutorial

Learn Java from your first program to OOP, collections, streams, concurrency and JVM internals. Each topic has a clear explanation, working code, key points and interview questions.

30 topics · Beginner → Expert · concept, code, interview questions and a test in every topic

Your progress0%

Beginner lessons

0/5 · 0%
  1. 1Java, JDK, JRE & JVMHow Java code is compiled and run anywhere.
  2. 2Variables, Data Types & OperatorsPrimitives, references, casting and operators.
  3. 3Control Flow & Loopsif/else, switch expressions, for, while and enhanced for.
  4. 4Arrays & StringsFixed-size arrays, immutable Strings and StringBuilder.
  5. 5Methods & RecursionParameters, return values, overloading and recursion.

Intermediate lessons

0/6 · 0%
  1. 6Classes, Objects & ConstructorsBlueprints, instances, this, static and records.
  2. 7OOP: Encapsulation, Inheritance, PolymorphismThe pillars of object-oriented Java.
  3. 8Abstract Classes & InterfacesContracts, default methods and sealed types.
  4. 9Exception Handlingtry/catch/finally, checked vs unchecked, custom exceptions.
  5. 10Collections FrameworkList, Set, Map, Queue and choosing the right one.
  6. 11Functions Reference: Core Utilities, Strings & MathString, Math, Arrays, Collections and wrapper-class methods you'll use every day.

Advanced lessons

0/4 · 0%
  1. 12Functions Reference: Collections & Stream APIList, Set and Map methods, Collections utilities and Stream pipelines with complexity notes.
  2. 13GenericsType-safe reusable code, bounds and wildcards.
  3. 14Lambdas & Stream APIFunctional style: map, filter, reduce and collectors.
  4. 15Multithreading BasicsThreads, synchronization, volatile and race conditions.

Expert lessons

0/3 · 0%
  1. 16Executors, CompletableFuture & Virtual ThreadsModern concurrency utilities for real applications.
  2. 17JVM Memory & Garbage CollectionHeap, stack, metaspace and how GC reclaims memory.
  3. 18Design Patterns & SOLIDSingleton, Factory, Builder, Strategy and SOLID principles.

Interview preparation

Module — Core Technical Interview Q&A (Top Questions & Answers)

6 questions · 0 completed · 0%

Beginner: 1 · Freshers · 0 yearsBasic: 1 · Entry level · 0–1 yearsIntermediate: 1 · Junior · 1–3 yearsAdvanced: 1 · Mid-level · 3–5 yearsExpert: 1 · Senior · 5–8 yearsArchitect / Specialist: 1 · Specialist · 8–10+ years
  1. Beginner · Fundamentals

    Can a Java method replace the caller’s object reference?

    Java passes all arguments by value. For object arguments, the copied value is a reference, so a method can mutate the referenced object but cannot rebind the caller's variable.

  2. Basic · Collections

    Why must equal HashMap keys have the same hash code?

    HashMap uses a hash to select candidate storage and equals to find an equivalent key. Equal objects must have equal hashes, although unequal objects may collide.

  3. Intermediate · Internals

    What really happens when HashMap collisions exceed the tree threshold?

    Java 8+ HashMap may treeify a heavily collided bucket, but the minimum table-capacity condition matters: at small capacities it resizes instead of immediately using a tree.

  4. Advanced · Concurrency

    Why is volatile count++ still a race?

    volatile provides visibility and ordering guarantees for reads and writes, but count++ is a read-modify-write sequence. Two threads can read the same value and each publish the same increment.

  5. Expert · Production debugging

    How would you investigate rising JVM latency and old-generation usage?

    Correlate p95/p99 latency with GC pauses, allocation rates and heap occupancy after full collections. High allocation pressure and retained objects are different problems.

  6. Architect / Specialist · Architecture

    Why don’t virtual threads remove the need for backpressure?

    Virtual threads reduce the cost of blocking-thread concurrency, but they do not increase database connection capacity, CPU throughput or external-service rate limits.

Module — Coding Interview Problems & Solutions (Hands-on)

6 questions · 0 completed · 0%

Beginner: 1 · Freshers · 0 yearsBasic: 1 · Entry level · 0–1 yearsIntermediate: 1 · Junior · 1–3 yearsAdvanced: 1 · Mid-level · 3–5 yearsExpert: 1 · Senior · 5–8 yearsArchitect / Specialist: 1 · Specialist · 8–10+ years
  1. Beginner · Strings

    Reverse Unicode code points in Java

    Return a new string with Unicode code points reversed, without splitting surrogate pairs.

  2. Basic · Hashing

    Find the first unique Unicode code point

    Return the numeric code point of the first non-repeated code point, or -1 if absent.

  3. Intermediate · Prefix sum

    Count contiguous subarrays summing to K

    Return the number of nonempty contiguous subarrays whose sum equals K.

  4. Advanced · Streams

    Compute department averages with collectors

    Return average integer salary per department without mutating the input list.

  5. Expert · Concurrency

    Implement thread-safe lazy initialization with the holder idiom

    Return the same lazily initialized Registry instance to every ordinary caller in one class-loader domain.

  6. Architect / Specialist · Production concurrency

    Build a bounded producer-consumer channel with explicit completion

    Transfer positive integers through a capacity-two queue, sum them in a consumer and terminate with an explicit reserved sentinel.

A–Z index

Can't find a Java topic you need for exams or placements? Request it and we'll add it.