Learning roadmap
A guided path from fundamentals to advanced — work through each stage in order.
1
What is the difference between Minor GC, Major GC, and Full GC?What are the different types of inner classes in Java — member, static nested, local, and anonymous?What is the difference between JDK, JRE, and JVM?What is an OutOfMemoryError vs StackOverflowError?Explain the 4 pillars of OOP with real-world examples.What is the difference between a static nested class and a (non-static) inner class in Java?What is the difference between == and .equals() in Java?G1 GC vs ZGC vs Shenandoah — when would you choose each?What is a local inner class in Java? What are the rules around accessing variables from its enclosing method?Heap keeps growing even after a Full GC runs. How do you debug it?What is method overloading vs method overriding?What are anonymous inner classes in Java, and what are their restrictions compared to named classes?What is the difference between abstract class and interface?What is the difference between byte streams and character streams in Java I/O — when do you use InputStream/OutputStream vs Reader/Writer?Production throws OutOfMemoryError: Metaspace. What could cause it?What is the difference between FileReader and BufferedReader, and why does wrapping one in the other improve performance?Java heap is stable, but overall process memory keeps growing. Why?Explain the 'static' keyword — static variable, method, block, class.Your application pauses frequently, but GC logs look completely normal. What's going on?What is the difference between pass-by-value and pass-by-reference in Java?What is the difference between java.io and java.nio? What does NIO's non-blocking, buffer-based model actually change?Why should file handling code always use try-with-resources instead of manually closing streams in a finally block?What is autoboxing and unboxing?What is Escape Analysis? Why is it useful?How do Java enums work internally? What do values(), ordinal(), and valueOf() actually do?What is the diamond problem and how does Java 8 solve it with default methods?What is the Parent Delegation Model in class loading, and why is it important?How do you capture and analyze a heap dump using Eclipse MAT — what do you actually look for?Explain how 'instanceof' works and what pattern matching for instanceof (Java 16) does.Can a Java enum have constructors, fields, and methods? Can each enum constant override a method differently?Why are enums a good fit for switch statements and as HashMap/EnumMap keys?What is TLAB (Thread Local Allocation Buffer) and how does it improve allocation performance?What is String immutability? Why is String immutable in Java?What is GC ergonomics and how does the JVM auto-tune GC settings?What is the String constant pool?Why do Virtual Threads become pinned and lose scalability?What is the difference between String, StringBuilder, and StringBuffer?Find the longest palindromic substring.What is structured concurrency in Java 21+ and why is it better than raw CompletableFuture chains?Minimum window substring — find the smallest window in S containing all characters of T.Why are exceptions inside CompletableFuture chains often missed silently?What is the difference between Array and ArrayList?ConcurrentHashMap is thread-safe, yet race conditions can still exist in code that uses it. Why?Find the maximum subarray sum (Kadane's algorithm).Why can increasing the thread pool size actually reduce application performance?Sort an array of 0s, 1s, and 2s in a single pass (Dutch National Flag).What is the difference between synchronized, ReentrantLock, and StampedLock?Trapping rainwater problem — compute how much water can be trapped.What is the difference between CountDownLatch, CyclicBarrier, and Semaphore?Find the longest increasing subsequence (LIS).How does ForkJoinPool differ from a regular ThreadPoolExecutor?Explain the Collections hierarchy — List, Set, Map, Queue.What happens when you submit too many tasks to a ThreadPoolExecutor — what are the rejection policies?What is a race condition and how is it different from a data race?How does HashMap work internally? (hashing, buckets, collision)What is the difference between HashMap and Hashtable?A ThreadLocal variable in your app is causing a memory leak. How does that happen, and how do you fix it?How does ConcurrentHashMap differ from HashMap?A HashMap has millions of entries and suddenly becomes slow. How would you investigate?What is fail-fast vs fail-safe iterator?You insert a mutable object as a HashMap key and later modify it. What can go wrong?Implement an LRU cache using LinkedHashMap.Your CopyOnWriteArrayList is creating high memory usage and GC pressure. Why?A ConcurrentModificationException occurs in a single-threaded application. How is that possible?What happens when HashMap capacity exceeds load factor? Explain rehashing.What are the key features introduced in Java 8?You're reviewing production code using Collections.synchronizedMap(). Would you keep it or replace it? What factors decide?Why can a poor hashCode() implementation destroy HashMap performance?What is a functional interface? Can you write a custom one?What is the difference between map() and flatMap() in Streams?Two threads call computeIfAbsent() for the same key on a ConcurrentHashMap at the same time. What behavior do you expect?What is EnumMap and why is it more performant than HashMap for enum keys?What is the Optional class? How does it prevent NullPointerException?You need the top 10 most frequent items out of millions of events. Which collections would you combine to solve this efficiently?What is the difference between lazy and eager evaluation in Streams? Explain with an example.What is the difference between checked and unchecked exceptions?A cache should automatically release entries when their keys are no longer strongly referenced elsewhere. What would you use?Are Java Records truly immutable? What are their limitations?What is try-with-resources? How does it differ from traditional try-catch-finally?How do you create a custom exception? Give checked and unchecked examples.What are Sealed Classes in Java 17 — how do they enforce domain modeling?What is exception chaining?What is Pattern Matching for switch (Java 21) and how does it improve type-safe branching?What are Sequenced Collections in Java 21?What is the difference between ClassNotFoundException and NoClassDefFoundError?What is the difference between a Thread and a Process?How does Java 21's virtual thread implementation handle blocking I/O internally — what is carrier thread pinning?What is the difference between var (Java 10) and explicitly typed declarations — when does var hurt readability?What is the difference between wait(), notify(), and notifyAll()?Java 25 Compact Object Headers (JEP 519) — what does it mean for production workloads?What is a deadlock? How can you detect and prevent it?What is the Sliding Window pattern in DSA, and what class of problems does it solve efficiently?What is the volatile keyword in Java?What is the two-pointer pattern? Give an example problem where it turns an O(n²) solution into O(n).What is ExecutorService? How is it better than creating raw threads?What is the fast & slow pointers pattern? How does it detect a cycle in a linked list?What is a thread-safe Singleton? Implement double-checked locking.What is the merge intervals pattern? Walk through merging a list of overlapping intervals.What is the Java Memory Model (JMM)? Explain happens-before.What is the Top K Elements pattern using a heap, and why is it more efficient than sorting the entire dataset?What is CompletableFuture? How does it differ from Future?Reverse a Singly Linked ListWhat is the 0/1 Knapsack dynamic programming pattern, and what other problems share its structure?Detect a loop in a Linked ListWhat is the topological sort graph pattern? How does it apply to a course-scheduling / build-order problem?Find the Kth largest element in a stream of numbers, where new numbers keep arriving.LRU Cache implementationBinary Tree TraversalsImplement an LFU (Least Frequently Used) Cache with O(1) get and put.Find the median from a data stream — numbers keep arriving one at a time, and you must return the median at any point.Validate a Binary Search Tree (BST)Solve the Word Ladder problem — find the shortest transformation sequence from one word to another, changing one letter at a time.Dijkstra's Shortest Path AlgorithmTopological SortWhat are the different memory areas in JVM?What is Garbage Collection and how does it work?What is ClassLoader? Explain the delegation model.What is the difference between WeakReference, SoftReference, and PhantomReference?How does the JIT compiler work?Singleton PatternBuilder Pattern vs Telescoping ConstructorSOLID Principles overviewWhat is Code Cache and what happens when it fills up?What does the -XX:+PrintCompilation flag show you?What are the performance trade-offs between a 32-bit and 64-bit JVM?What is an escaping reference, and what are the ways to prevent your internal mutable state from leaking to callers?How do you tune the String Pool for an application creating millions of unique strings?What is String Deduplication in G1 GC and how is it different from the String Pool?Why should -Xms and -Xmx be set to the same value in production?What are the most important JVM flags you should know for production tuning?Why should you never call System.gc() in production code?Why is Object.finalize() dangerous, and what should you use instead?What is Java Flight Recorder and how is it different from a heap dump?Why is naive Java benchmarking (System.nanoTime() around a loop) misleading?What is JMH and what does it handle that a hand-rolled benchmark doesn't?What is a DirectByteBuffer, and why can it cause OutOfMemoryError even when heap usage looks fine?Your Java process consumes 100% CPU — walk through diagnosing exactly which thread and method is responsible.What does jcmd VM.native_memory reveal that a heap dump cannot?Your Spring Boot app gets OOM-killed in Kubernetes even though heap usage looks fine — how do you size JVM memory correctly for a container?What are the different types of OutOfMemoryError, and what does each one actually mean?What tools would you reach for to monitor a Java application's performance in production?What is GraalVM and how does its Native Image differ from a standard JVM?Does the final keyword make an object immutable?When should you choose ArrayList over LinkedList (and vice versa)?What are the two mandatory rules for overriding hashCode(), and what breaks if you only override equals()?When would you use TreeMap or LinkedHashMap over a plain HashMap?Why can naive string concatenation in a loop hurt performance, and did Java 9 change this?When can a Stream pipeline actually be slower than a plain for-loop?Why should you never use double for financial calculations?Why does volatile guarantee visibility but not atomicity?How does ConcurrentHashMap achieve thread safety without locking the entire map?When would you choose LongAdder over AtomicInteger?How do you size a ThreadPoolExecutor differently for CPU-bound vs I/O-bound workloads?What's the difference between thenApply(), thenCompose(), and thenCombine() in CompletableFuture?You receive a production thread dump with hundreds of BLOCKED threads — how do you identify the root cause?
Open Core Java →2
3
4
5
6