Mid-Level Developer Interview Questions and Answers
Mid-level interviews focus on trade-offs and ownership. Interviewers want to see that you have hit real problems such as slow queries, race conditions or re-render storms, and know how to reason your way through them.
HashMap is not thread-safe, Hashtable is thread-safe by locking the whole map on every method, and ConcurrentHashMap is thread-safe with much finer-grained locking and lock-free reads, so it scales far better.
The JVM divides memory into a per-thread stack, a shared heap (split into young and old generations) and Metaspace; the garbage collector frees heap objects that are no longer reachable, collecting short-lived young objects frequently and old objects less often.