Core Java

OOP, Collections, Strings, Exceptions, JVM internals.

29 questions
OOPCollectionsStringExceptionsStreamsMultithreadingJVM

Sample Questions (29 live)

CollectionsEasy

What is a HashMap?

AmazonInfosysTCSRead →
CollectionsMedium

What is the difference between HashMap and Hashtable?

DeloitteInfosysAccentureRead →
OOPMedium

Why must you override equals() and hashCode() together?

AmazonDeloitteRead →
CollectionsEasy

How does an ArrayList grow internally?

InfosysTCSAccentureRead →
CollectionsEasy

What is a Queue and when would you use one?

InfosysTCSAccentureRead →
CollectionsEasy

What is a Stack and how does it differ from a Queue?

AmazonInfosysAccentureRead →
CollectionsMedium

How does a LinkedList work, and when beats ArrayList?

InfosysDeloitteTCSRead →
StringsEasy

Why does comparing two Strings with == sometimes pass and sometimes fail in production?

InfosysTCSCognizantRead →
StringsEasy

Why is String immutable in Java, and how does that help a high-throughput service?

AmazonInfosysTCSRead →
ExceptionsEasy

Checked vs unchecked exceptions — which do you use in a service layer, and why?

CognizantAccentureInfosysRead →
PrimitivesEasy

How can autoboxing silently slow down a hot loop or cause a subtle bug?

AmazonMicrosoftWiproRead →
StringsMedium

How does String interning work, and when would you actually use intern() in production?

AmazonGoogleDeloitteRead →
ExceptionsMedium

How does try-with-resources prevent JDBC connection and file-handle leaks?

DeloitteCognizantAccentureRead →
StringsMedium

StringBuilder vs StringBuffer — does the difference still matter in modern code?

InfosysTCSCapgeminiRead →
OOPMedium

Comparable vs Comparator — how do you sort domain objects by multiple fields?

AmazonCognizantDeloitteRead →
GenericsMedium

How does generic type erasure affect runtime behavior, and what breaks because of it?

AmazonMicrosoftGoogleRead →
OOPMedium

Why prefer enums over int/String constants, and how do you put behavior in an enum?

AmazonDeloitteAccentureRead →
OOPMedium

Is Java pass-by-value or pass-by-reference? Prove it.

InfosysTCSCognizantRead →
OOPMedium

How do you design a correct immutable class for a multi-threaded service?

AmazonMicrosoftDeloitteRead →
JVM/Class loadingMedium

How can static initialization order cause a subtle bug or even a deadlock?

GoogleAmazonMicrosoftRead →
ExceptionsMedium

What are the exception anti-patterns that cause silent failures in production?

AmazonDeloitteCognizantRead →
Memory/GCHard

A long-running service's heap keeps growing until OutOfMemoryError — how do you diagnose it?

AmazonMicrosoftGoogleRead →
Memory/GCHard

How can ThreadLocal cause a memory leak in a thread-pool / application server?

AmazonDeloitteGoogleRead →
SerializationHard

What are the pitfalls of Java serialization in distributed/enterprise systems?

AmazonMicrosoftDeloitteRead →
Memory/GCHard

Why is finalize() discouraged, and what replaces it for resource cleanup?

GoogleAmazonMicrosoftRead →
OOPHard

How should equals() and hashCode() be implemented for JPA/Hibernate entities?

DeloitteAmazonCognizantRead →
JVM/Class loadingHard

What causes a ClassLoader leak on application redeploy, and how do you fix it?

AmazonMicrosoftDeloitteRead →
PrimitivesMedium

What's the real cost of excessive object creation, and how do IntStream/LongStream avoid the autoboxing tax Stream<Integer> pays?

AmazonGoogleMicrosoftRead →
OOPMedium

Records vs Lombok @Value for DTOs — what do you actually gain and lose?

AmazonMicrosoftDeloitteRead →

Advertisement

Google AdSense slot