Java

62 questions

OOP, collections, concurrency, JVM internals, functional programming, exception handling, serialization, design patterns, and modern Java features.

1JuniorOOPTCSInfosysWiproAmazon

Four Pillars of OOP

Explain the four pillars of OOP in Java with examples. How does Java implement each?

🔒
2JuniorOOPGoogleAmazonFlipkart

Abstract Class vs Interface

When do you use an abstract class vs an interface in Java? How has this changed since Java 8?

🔒
3SeniorOOPGoogleMicrosoftAmazon

Composition vs Inheritance

Why do experienced developers prefer composition over inheritance? Give a real-world example.

🔒
4SeniorOOPGoldman SachsMorgan StanleyAmazon

equals(), hashCode(), and the Contract

Why must you override hashCode() when you override equals()? What happens if you don't?

🔒
5SeniorOOPGoogleNetflixJPMC

Immutability in Java

How do you create an immutable class in Java? Why is immutability important in concurrent systems?

🔒
6SeniorOOPAmazonGoogleMicrosoftUber

SOLID Principles

Explain the SOLID principles with Java examples. Which one do you think is most commonly violated?

🔒
7SeniorOOPGoogleAmazonGoldman Sachs

Generics and Type Erasure

How do Java generics work under the hood? What is type erasure and what are its implications?

🔒
8JuniorOOPTCSInfosysCognizantJPMC

final, finally, finalize

Explain the difference between final, finally, and finalize in Java.

🔒
9SeniorCollectionsAmazonGoldman SachsGoogleJPMC

HashMap Internals

How does HashMap work internally in Java? Walk through a put() and get() operation.

🔒
10SeniorCollectionsGoldman SachsJPMCMorgan StanleyAmazon

ConcurrentHashMap vs Hashtable vs SynchronizedMap

Compare ConcurrentHashMap, Hashtable, and Collections.synchronizedMap(). Which should you use?

🔒
11JuniorCollectionsAmazonTCSFlipkart

ArrayList vs LinkedList

When would you use ArrayList vs LinkedList? What are the time complexities?

🔒
12JuniorCollectionsAmazonMicrosoftGoldman Sachs

TreeMap vs HashMap vs LinkedHashMap

Compare TreeMap, HashMap, and LinkedHashMap. When do you use each?

🔒
13JuniorCollectionsAmazonTCSFlipkartJPMC

Comparable vs Comparator

What's the difference between Comparable and Comparator? When do you use each?

🔒
🔒 49 more premium questions
Upgrade to PRO — ₹1,499/month
14SeniorCollectionsGoldman SachsAmazonJPMC🔒 Premium

Fail-Fast vs Fail-Safe Iterators

What are fail-fast and fail-safe iterators? Give examples of each.

🧠 What they're really testing
🔒
15SeniorCollectionsGoogleAmazonNetflix🔒 Premium

Stream Collectors and Grouping

Show advanced Stream collector patterns — groupingBy, partitioning, custom collectors.

🧠 What they're really testing
🔒
16JuniorCollectionsTCSInfosysWipro🔒 Premium

Collections Utility Methods

What are the key utility methods in java.util.Collections and java.util.Arrays?

🧠 What they're really testing
🔒
17JuniorFunctional ProgrammingAmazonGoogleFlipkart🔒 Premium

Lambda Expressions and Functional Interfaces

What are lambda expressions in Java? What is a functional interface?

🧠 What they're really testing
🔒
18JuniorFunctional ProgrammingAmazonGoogleMicrosoftFlipkart🔒 Premium

Streams API — map, filter, reduce

Explain Java Streams with practical examples of map, filter, flatMap, and reduce.

🧠 What they're really testing
🔒
19JuniorFunctional ProgrammingGoogleAmazonJPMC🔒 Premium

Optional — Avoiding NullPointerException

How does Optional work? Show the right and wrong ways to use it.

🧠 What they're really testing
🔒
20JuniorFunctional ProgrammingAmazonTCSGoogle🔒 Premium

Method References

Explain the four types of method references in Java with examples.

🧠 What they're really testing
🔒
21SeniorFunctional ProgrammingNetflixAmazonGoogle🔒 Premium

Streams: Parallel Streams and Pitfalls

When should you use parallel streams? What are the pitfalls?

🧠 What they're really testing
🔒
22SeniorFunctional ProgrammingGoogleAmazonMicrosoft🔒 Premium

Stream: Lazy Evaluation and Short-Circuiting

Explain lazy evaluation in Streams. How does short-circuiting work?

🧠 What they're really testing
🔒
23SeniorFunctional ProgrammingGoogleNetflixAmazon🔒 Premium

Functional Composition and Chaining

Show how to compose functions in Java. What's andThen vs compose?

🧠 What they're really testing
🔒
24SeniorFunctional ProgrammingGoogleAmazonNetflix🔒 Premium

Functional Interfaces: Beyond the Basics

Explain specialized functional interfaces (IntFunction, BiConsumer, etc.) and when to use them.

🧠 What they're really testing
🔒
25JuniorConcurrencyAmazonJPMCGoldman Sachs🔒 Premium

Thread Creation: Thread vs Runnable vs Callable

What are the different ways to create threads in Java? Which should you use?

🧠 What they're really testing
🔒
26SeniorConcurrencyGoldman SachsMorgan StanleyAmazonGoogle🔒 Premium

synchronized, volatile, and Atomic

Explain synchronized, volatile, and atomic classes. When do you use each?

🧠 What they're really testing
🔒
27SeniorConcurrencyAmazonGoogleNetflixJPMC🔒 Premium

ExecutorService and Thread Pools

Explain the different thread pool types. How do you size a thread pool?

🧠 What they're really testing
🔒
28SeniorConcurrencyAmazonGoogleNetflixUber🔒 Premium

CompletableFuture for Async Programming

Show practical CompletableFuture patterns — chaining, combining, error handling.

🧠 What they're really testing
🔒
29SeniorConcurrencyGoldman SachsJPMCAmazonGoogle🔒 Premium

Deadlock, Livelock, and Starvation

Explain deadlock, livelock, and starvation. How do you prevent deadlocks?

🧠 What they're really testing
🔒
30SeniorConcurrencyAmazonGoldman SachsJPMC🔒 Premium

Producer-Consumer Pattern

Implement the producer-consumer pattern in Java. What data structures do you use?

🧠 What they're really testing
🔒
31SeniorConcurrencyGoldman SachsAmazonMicrosoft🔒 Premium

ReentrantLock vs synchronized

When would you use ReentrantLock over synchronized?

🧠 What they're really testing
🔒
32SeniorConcurrencyGoogleAmazonGoldman Sachs🔒 Premium

CountDownLatch, CyclicBarrier, Semaphore

Explain CountDownLatch, CyclicBarrier, and Semaphore with real-world use cases.

🧠 What they're really testing
🔒
33SeniorConcurrencyAmazonJPMCGoldman Sachs🔒 Premium

Thread-Local Storage

What is ThreadLocal? When is it useful and what are the pitfalls?

🧠 What they're really testing
🔒
34SeniorConcurrencyGoogleNetflixAmazon🔒 Premium

Virtual Threads (Project Loom)

What are virtual threads in Java 21? How do they differ from platform threads?

🧠 What they're really testing
🔒
35JuniorException HandlingTCSInfosysAmazonJPMC🔒 Premium

Checked vs Unchecked Exceptions

Explain the exception hierarchy in Java. What's the difference between checked and unchecked exceptions?

🧠 What they're really testing
🔒
36JuniorException HandlingAmazonJPMCGoldman Sachs🔒 Premium

Try-with-Resources and AutoCloseable

What is try-with-resources? How does it work with AutoCloseable?

🧠 What they're really testing
🔒
37SeniorException HandlingGoogleAmazonNetflix🔒 Premium

Exception Handling Best Practices

What are exception handling anti-patterns and best practices in Java?

🧠 What they're really testing
🔒
38JuniorException HandlingTCSAmazonFlipkart🔒 Premium

Multi-Catch and Exception Chaining

Explain multi-catch blocks and exception chaining in Java.

🧠 What they're really testing
🔒
39SeniorSerializationAmazonGoldman SachsJPMC🔒 Premium

Java Serialization: Serializable and serialVersionUID

How does Java serialization work? What is serialVersionUID and why does it matter?

🧠 What they're really testing
🔒
40SeniorSerializationAmazonGoogleNetflixFlipkart🔒 Premium

JSON Serialization with Jackson

How do you use Jackson for JSON serialization in Java? Show common patterns and pitfalls.

🧠 What they're really testing
🔒
41SeniorSerializationGoogleUberNetflix🔒 Premium

Protocol Buffers and Binary Serialization

Compare JSON, Protocol Buffers, and Avro for data serialization. When do you use each?

🧠 What they're really testing
🔒
42SeniorSerializationGoldman SachsJPMC🔒 Premium

Externalizable vs Serializable

What's the difference between Externalizable and Serializable? When would you use each?

🧠 What they're really testing
🔒
43SeniorJVM & MemoryAmazonGoogleGoldman SachsJPMC🔒 Premium

JVM Memory Model: Heap, Stack, Metaspace

Explain the JVM memory model. What goes on heap, stack, and metaspace?

🧠 What they're really testing
🔒
44SeniorJVM & MemoryAmazonGoogleNetflixGoldman Sachs🔒 Premium

Garbage Collection: G1, ZGC, CMS

Explain garbage collection in Java. Compare G1, ZGC, and CMS collectors.

🧠 What they're really testing
🔒
45SeniorJVM & MemoryGoogleAmazonJPMC🔒 Premium

ClassLoader and Class Loading

Explain the ClassLoader hierarchy and how class loading works in Java.

🧠 What they're really testing
🔒
46LeadJVM & MemoryGoogleGoldman SachsNetflix🔒 Premium

JIT Compilation and Performance

How does JIT compilation work in the JVM? What's the difference between C1 and C2 compilers?

🧠 What they're really testing
🔒
47SeniorJVM & MemoryAmazonGoogleJPMCNetflix🔒 Premium

Memory Leaks in Java

How can memory leaks happen in Java despite garbage collection? How do you detect them?

🧠 What they're really testing
🔒
48JuniorJVM & MemoryTCSAmazonFlipkartJPMC🔒 Premium

String Pool and String Internals

How does the String pool work? What's the difference between String, StringBuilder, and StringBuffer?

🧠 What they're really testing
🔒
49SeniorDesign PatternsAmazonGoogleGoldman SachsJPMC🔒 Premium

Singleton Pattern — Thread-Safe Implementation

Show different ways to implement Singleton in Java. Which is thread-safe?

🧠 What they're really testing
🔒
50SeniorDesign PatternsAmazonGoogleMicrosoft🔒 Premium

Factory and Abstract Factory Pattern

Explain Factory and Abstract Factory patterns with practical Java examples.

🧠 What they're really testing
🔒
51JuniorDesign PatternsAmazonGoogleFlipkart🔒 Premium

Builder Pattern

Implement the Builder pattern in Java. When should you use it?

🧠 What they're really testing
🔒
52SeniorDesign PatternsAmazonGoogleMicrosoft🔒 Premium

Observer Pattern

Implement the Observer pattern. How is it used in real systems?

🧠 What they're really testing
🔒
53SeniorDesign PatternsAmazonGoogleJPMC🔒 Premium

Strategy Pattern

Implement the Strategy pattern. How does it relate to functional programming in Java?

🧠 What they're really testing
🔒
54SeniorDesign PatternsGoogleAmazonNetflix🔒 Premium

Decorator Pattern

Explain the Decorator pattern. Where is it used in the Java standard library?

🧠 What they're really testing
🔒
55SeniorDesign PatternsAmazonJPMCGoogle🔒 Premium

Template Method Pattern

Implement the Template Method pattern. How is it different from Strategy?

🧠 What they're really testing
🔒
56JuniorModern JavaGoogleAmazonNetflix🔒 Premium

Records (Java 16+)

What are Java Records? When should and shouldn't you use them?

🧠 What they're really testing
🔒
57SeniorModern JavaGoogleAmazon🔒 Premium

Sealed Classes (Java 17)

What are sealed classes? How do they improve domain modeling?

🧠 What they're really testing
🔒
58SeniorModern JavaGoogleAmazonNetflix🔒 Premium

Pattern Matching (instanceof and switch)

Explain pattern matching in Java 16-21. How does it improve code?

🧠 What they're really testing
🔒
59JuniorModern JavaAmazonTCSFlipkart🔒 Premium

Switch Expressions (Java 14+)

How do switch expressions differ from switch statements? Show the modern syntax.

🧠 What they're really testing
🔒
60JuniorModern JavaAmazonFlipkartTCS🔒 Premium

Text Blocks and New String Methods

What are text blocks in Java? What useful String methods were added in Java 11-17?

🧠 What they're really testing
🔒
61JuniorModern JavaAmazonGoogleFlipkart🔒 Premium

var and Local Variable Type Inference

How does var work in Java 10+? When should and shouldn't you use it?

🧠 What they're really testing
🔒
62JuniorModern JavaAmazonTCSFlipkart🔒 Premium

New Collection Factory Methods

What collection factory methods were added in Java 9-16? How do they improve code?

🧠 What they're really testing
🔒