Skip to content

Java Last-Minute Revision

Quickly revise the questions you picked. Add questions from the interview-questions lists with Save to → Last-Minute Revision.

30 quick revision notes for Java

  1. The JVM runs bytecode, the JDK adds compiler and tools, and since Java 11 vendors ship only the JDK.
  2. Java has eight primitives; char is 2 bytes and holds a UTF-16 code unit, and boolean size is JVM dependent.
  3. == compares references for objects while equals() compares content; always use equals() for strings and wrappers.
  4. Integer caching covers values from -128 to 127, so == on larger boxed Integers usually returns false.
  5. Objects live on the shared heap, local variables live on each thread stack, and class metadata lives in metaspace.
  6. G1 is the default garbage collector since Java 9, and ZGC gives sub-millisecond pauses on very large heaps.
  7. If two objects are equal by equals(), they must return the same hashCode(), or HashMap lookups fail.
  8. Java allows single class inheritance but multiple interface inheritance; default method conflicts must be overridden.
  9. Overloading is resolved at compile time and overriding at runtime; static and private methods cannot be overridden.
  10. Records generate constructor, accessors, equals, hashCode and toString, and are shallowly immutable final classes.
  11. Strings are immutable and pooled; use StringBuilder for repeated concatenation inside loops.
  12. Checked exceptions must be caught or declared, unchecked exceptions extend RuntimeException and need no declaration.
  13. try-with-resources closes AutoCloseable resources automatically in reverse order and keeps suppressed exceptions.
  14. HashMap uses buckets with linked lists that turn into red-black trees after 8 entries when capacity is at least 64.
  15. HashMap resizes to double capacity when size crosses capacity times the default load factor of 0.75.
  16. ConcurrentHashMap does not allow null keys or values and offers atomic compute, merge and putIfAbsent methods.
  17. ArrayList gives O(1) random access, while LinkedList gives O(1) insertion at the ends but O(n) access by index.
  18. TreeMap keeps keys sorted with O(log n) operations and supports floorKey, ceilingKey and range views.
  19. Fail-fast iterators throw ConcurrentModificationException when the collection is changed outside the iterator.
  20. volatile guarantees visibility and ordering but not atomicity; use AtomicInteger or LongAdder for counters.
  21. Prevent deadlocks by acquiring locks in a fixed global order and using tryLock with timeouts.
  22. Virtual threads in Java 21 are cheap JVM managed threads, ideal for blocking I/O but not for CPU heavy work.
  23. Stream intermediate operations are lazy and run only when a terminal operation like collect or count is called.
  24. map transforms one element to one element, while flatMap turns each element into a stream and flattens them.
  25. Use Optional as a return type only; avoid it for fields and parameters, and avoid calling get() without a check.
  26. PreparedStatement prevents SQL injection by sending parameters separately from the SQL text.
  27. The N+1 problem is fixed with JOIN FETCH, entity graphs or batch fetching, and detected through SQL logs.
  28. @Transactional works through a proxy, so self-invocation skips it and checked exceptions do not roll back by default.
  29. Prefer constructor injection in Spring because dependencies can be final and classes are easy to unit test.
  30. Spring Boot 3 needs Java 17 or later and uses jakarta packages instead of javax for persistence and servlets.

Night-before checklist

  • Revise your saved questions on this page once, aloud.
  • Read the quick notes and mark any you cannot explain in one line.
  • Rehearse a two-minute self-introduction and two project stories.
  • Keep CV, ID, laptop charger and interview link ready; sleep on time.

Frequently asked questions

How does Last-Minute Revision work?

On any question page, open Save to → Last-Minute Revision. Saved questions appear here with their answers, so the night before an interview you revise only what you found hard.

Is my list saved?

Yes, in this browser. Guests can save 5 questions; free accounts can save 20 for revision and 100 for the 7-day plan.

What should I revise last before a Java interview?

Your saved misses first, then the quick notes on this page, then one or two project stories. Avoid learning brand-new topics the night before.