Core Java Interview Questions

OOP, Collections, Concurrency, JVM internals, Java 8+ features, and modern Java (records, virtual threads).

OOPCollectionsConcurrencyJVMJava 8+Aria-powered explanations
0 / 100 answered
0%
30 Easy51 Medium19 Hard

Showing 120 of 100

#1What is the difference between == and .equals() in Java?

Easy
Core Java

#2What is the difference between abstract class and interface?

Easy
OOP

#3Explain the SOLID principles.

Medium
OOP

#4How does HashMap work internally?

Medium
Collections

#5What is the difference between HashMap and ConcurrentHashMap?

Medium
Collections

#6Explain Java Memory Model: Heap, Stack, and Metaspace.

Medium
JVM

#7What is the volatile keyword in Java?

Medium
Concurrency

#8What is the difference between synchronized and ReentrantLock?

Hard
Concurrency

#9What is a deadlock and how do you prevent it?

Hard
Concurrency

#10What are functional interfaces and lambda expressions in Java 8?

Easy
Java 8+

#11What is Optional and when should you use it?

Easy
Java 8+

#12Explain the Stream API and intermediate vs terminal operations.

Medium
Java 8+

#13What is the difference between checked and unchecked exceptions?

Easy
Core Java

#14What is the difference between String, StringBuilder, and StringBuffer?

Easy
Core Java

#15What is garbage collection? How does G1 differ from ZGC?

Hard
JVM

#16What is method overloading vs method overriding?

Easy
OOP

#17What is the Java ClassLoader hierarchy?

Hard
JVM

#18What is the difference between final, finally, and finalize?

Easy
Core Java

#19What are Java records (Java 16+)?

Medium
Java 8+

#20What is the Executor framework and when would you use it over raw Threads?

Medium
Concurrency

Showing 120 of 100

Ask Aria about Core Java

Sign in to chat with Aria

All 100 Core Java questions at a glance
  1. What is the difference between == and .equals() in Java?(Easy)
  2. What is the difference between abstract class and interface?(Easy)
  3. Explain the SOLID principles.(Medium)
  4. How does HashMap work internally?(Medium)
  5. What is the difference between HashMap and ConcurrentHashMap?(Medium)
  6. Explain Java Memory Model: Heap, Stack, and Metaspace.(Medium)
  7. What is the volatile keyword in Java?(Medium)
  8. What is the difference between synchronized and ReentrantLock?(Hard)
  9. What is a deadlock and how do you prevent it?(Hard)
  10. What are functional interfaces and lambda expressions in Java 8?(Easy)
  11. What is Optional and when should you use it?(Easy)
  12. Explain the Stream API and intermediate vs terminal operations.(Medium)
  13. What is the difference between checked and unchecked exceptions?(Easy)
  14. What is the difference between String, StringBuilder, and StringBuffer?(Easy)
  15. What is garbage collection? How does G1 differ from ZGC?(Hard)
  16. What is method overloading vs method overriding?(Easy)
  17. What is the Java ClassLoader hierarchy?(Hard)
  18. What is the difference between final, finally, and finalize?(Easy)
  19. What are Java records (Java 16+)?(Medium)
  20. What is the Executor framework and when would you use it over raw Threads?(Medium)
  21. What is encapsulation and how is it achieved in Java?(Easy)
  22. What is polymorphism? Explain runtime vs compile-time polymorphism.(Easy)
  23. What is the difference between composition and inheritance?(Medium)
  24. What is a marker interface? Give examples.(Medium)
  25. What are the design patterns most commonly asked in Java interviews?(Medium)
  26. How do you implement a Singleton in Java correctly?(Hard)
  27. What is the difference between ArrayList and LinkedList?(Easy)
  28. What is the difference between HashSet, LinkedHashSet, and TreeSet?(Easy)
  29. What is the difference between HashMap and TreeMap?(Easy)
  30. What is the contract between equals() and hashCode()?(Medium)
  31. What is the difference between fail-fast and fail-safe iterators?(Medium)
  32. What is CopyOnWriteArrayList and when should you use it?(Medium)
  33. How does PriorityQueue work and when would you use it?(Medium)
  34. What is the happens-before relationship in Java Memory Model?(Hard)
  35. What is the difference between sleep(), wait(), and yield()?(Medium)
  36. What are atomic classes (AtomicInteger, AtomicReference)? How do they work?(Medium)
  37. What is a CountDownLatch vs CyclicBarrier?(Medium)
  38. What is a ThreadLocal and what are its dangers?(Hard)
  39. What is a CompletableFuture and how does it improve async programming?(Hard)
  40. What are virtual threads (Project Loom, Java 21)?(Hard)
  41. What is the difference between JDK, JRE, and JVM?(Easy)
  42. How does the JIT (Just-In-Time) compiler work?(Hard)
  43. What is the difference between minor GC, major GC, and full GC?(Hard)
  44. What tools do you use to diagnose JVM memory issues?(Hard)
  45. What is the String pool and how does string interning work?(Medium)
  46. What is type erasure in Java generics?(Hard)
  47. What is the difference between <? extends T> and <? super T>?(Hard)
  48. What are sealed classes (Java 17)?(Medium)
  49. What is pattern matching for instanceof (Java 16)?(Medium)
  50. What are text blocks (Java 15)?(Easy)
  51. What is the difference between map() and flatMap() in streams?(Medium)
  52. What are method references in Java 8?(Easy)
  53. What is the difference between Comparable and Comparator?(Medium)
  54. What is Stream.collect() and what are common Collectors?(Medium)
  55. What is try-with-resources and how does it work?(Medium)
  56. What is the difference between throw and throws?(Easy)
  57. What is exception chaining and why is it important?(Medium)
  58. What is the difference between Java IO and NIO?(Medium)
  59. What is Java Serialization and what are its pitfalls?(Hard)
  60. What is reflection in Java and when is it used?(Medium)
  61. What is the difference between deep copy and shallow copy?(Medium)
  62. What is autoboxing and unboxing? What are the performance implications?(Medium)
  63. What are enums in Java and what advanced features do they support?(Medium)
  64. What is the difference between static and instance initializer blocks?(Medium)
  65. What is the difference between String.format() and String.formatted()?(Easy)
  66. What is the var keyword (Java 10) and when should you use it?(Easy)
  67. What are Java modules (Java 9 — JPMS)?(Hard)
  68. What is the difference between an inner class, static nested class, and anonymous class?(Medium)
  69. What are the new switch expressions (Java 14)?(Medium)
  70. What is the difference between Runnable, Callable, and Future?(Medium)
  71. What is the difference between String.equals() and String.equalsIgnoreCase()?(Easy)
  72. What is the difference between Iterator and ListIterator?(Easy)
  73. What is the difference between abstract class and concrete class?(Easy)
  74. How do you handle NullPointerException in Java?(Medium)
  75. What is the Collections utility class? What are its most important methods?(Easy)
  76. What is the difference between Deque and Queue?(Medium)
  77. What is a WeakHashMap and when would you use it?(Hard)
  78. What is the difference between checked and unchecked exceptions — best practices for APIs?(Medium)
  79. What is the ternary operator and the null-coalescing equivalent in Java?(Easy)
  80. What is the difference between == null check and Objects.isNull()?(Easy)
  81. What is the difference between interface default methods and abstract class methods?(Medium)
  82. What is the difference between Iterable and Iterator?(Easy)
  83. What are the best practices for writing clean Java code?(Medium)
  84. What is the difference between a process and a thread in Java?(Easy)
  85. What is a race condition and how do you prevent it?(Medium)
  86. What is the difference between HashMap.computeIfAbsent() and getOrDefault()?(Medium)
  87. What is the purpose of the transient keyword?(Medium)
  88. What is method hiding in Java?(Hard)
  89. What is the difference between i++ and ++i in Java?(Easy)
  90. What are the Java 8 Date/Time APIs and why were they introduced?(Medium)
  91. What is the difference between HashMap.put() and HashMap.putIfAbsent()?(Medium)
  92. What is the difference between String.valueOf() and toString()?(Easy)
  93. What is an immutable class and how do you create one?(Medium)
  94. What is the covariant return type in Java?(Medium)
  95. What is the difference between static and instance methods?(Easy)
  96. What is the difference between Predicate.and(), Predicate.or(), and Predicate.negate()?(Medium)
  97. What is the Observer pattern and how is it implemented in Java?(Medium)
  98. What is the Strategy pattern in Java?(Medium)
  99. What is String.intern() and when should you use it?(Hard)
  100. What are the key differences between Java 8, 11, 17, and 21?(Medium)