Languages

Java Mastery

The JVM, OOP, collections, streams and concurrency for Java interviews and jobs.

  • Handwritten-style
  • Diagrams and tables
  • Worked examples

Who this notebook is for

Students and developers preparing for Java interviews or starting a Java job. It begins with how Java runs and builds up to collections and concurrency.

What you will be able to do

  • Explain how the JVM loads, compiles and runs your code
  • Use classes, interfaces, records and generics correctly
  • Choose the right collection and know how a HashMap works inside
  • Write simple multithreaded code and explain the memory model

What's inside

Pick a chapter and the notebook opens right there.

  1. Platform Architecture & JVM InternalsJDK vs JRE vs JVM, ClassLoader Delegation, Tiered JIT C1/C2, Escape Analysis, Bytecode javapStart here
  2. Language Fundamentals & Type SystemPrimitive Bit Widths, Promotion Rules, Bit-shifts (>>, >>>), Integer Cache (-128..127), BigDecimalStart here
  3. Control Flow, Loops & Pattern MatchingShort-Circuit Evaluation, Fail-Fast Iterators, Modern Switch Expressions, Pattern instanceof, Guarded PatternsStart here
  4. Object-Oriented Classes & LifecyclesAccess Modifiers, Constructor Chaining this()/super(), Initialization Order, equals/hashCode Contract, RecordsStart here
  5. Inheritance & Dynamic DispatchComposition vs Inheritance, Overloading vs Overriding, vtable Dispatch, Covariant Returns, final, Sealed ClassesStart here
  6. Abstract Classes & InterfacesSkeletal Implementations, Default & Static Methods, Private Methods, Diamond Resolution, Functional InterfacesStart here
  7. Memory Management & Garbage CollectionEden & Survivor Scavenge, GC Roots, Reference Types, Serial/Parallel/G1GC, ZGC Colored Pointers, Heap DumpsStart here
  8. String Manipulation & Memory PoolImmutability Security, String Constant Pool, Compact Strings byte[], StringBuilder Growth, Text Blocks (""")Start here
  9. Exception Handling ArchitectureThrowable Hierarchy, Checked vs Unchecked, try-catch-finally Invariants, try-with-resources, Domain ExceptionsStart here
  10. Generics & Type ErasureType Erasure, Bridge Methods, Bounded Types, PECS Rule (? extends vs ? super), Generic LimitationsStart here
  11. Collections: Lists & QueuesArrayList 1.5x Resizing Math, LinkedList Cache Misses, ArrayDeque Circular Buffer, PriorityQueue Binary HeapStart here
  12. Collections: Maps & SetsHashMap Hash Perturbation, Treeification at 8, ConcurrentHashMap CAS & Bucket Locks, LinkedHashMap LRU, TreeMapStart here
  13. Functional Programming & Stream APILambda invokedynamic, Method References, Primitive Streams, Lazy Pipelines, Collectors groupingBy, Parallel StreamsStart here
  14. Multithreading & Memory ModelThread States, JMM Happens-Before, volatile Memory Barriers, synchronized Lock Inflation, wait/notifyAll GuardsStart here
  15. Modern Concurrency & Virtual ThreadsThreadPoolExecutor Backpressure, CompletableFuture Async, StampedLock Optimistic Reads, Loom Virtual ThreadsStart here
  16. Java I/O, NIO.2 & SerializationByte/Char Streams, 8KB Buffer Decorators, NIO Channels & Selectors, NIO.2 Path/Files Zero-Copy, Serialization RCEStart here
  17. Reflection & Dynamic ProxiesReflection API Overhead, JPMS Strong Encapsulation, Custom Annotations, APT Code Gen, JDK vs CGLIB ProxiesStart here
  18. FAANG Technical Interview PlaybookTricky Java Output Traps, Production JVM Tuning Flags, Deadlock Diagnostics (jstack), Thread-Safe LRU Cache, Staff ChecklistStart here

Practice this

Put it to work on LakeBench.

Common questions

Is this for beginners or experienced developers?
It starts from the basics but goes deep on the topics interviews test, so a beginner can start at the front and an experienced developer can jump to a chapter.
Does it cover modern Java?
Yes. It includes records, pattern matching, streams and virtual threads alongside the classic topics.
Can I read a sample before I commit?
Yes. The contents pages and the first pages of every notebook can be read online, so you can judge the style before going further.

More in Languages

All notebooks