Java Programming Deep Dives
1. ConcurrentHashMap Internals
Explain segment locking, CAS operations, and Java 8+ optimizations (treeify buckets). Compare with HashMap/Hashtable.
2. Thread-Safe Singleton Implementations
Compare eager initialization, double-checked locking, and enum singleton. Discuss broken pre-Java 5 implementations.
3. Java Memory Model (JMM)
Explain visibility guarantees, reordering rules, and how volatile/synchronized enforce memory barriers.
4. Garbage Collection Algorithms
Contrast G1, CMS, and Serial GC. Discuss pause times, throughput, and use cases (low-latency vs. batch processing).
5. Immutable Object Design
Implement immutability for complex objects. Discuss final fields, defensive copying, and thread-safety benefits.
6. HashMap vs. ConcurrentHashMap
Compare synchronization strategies (entire map vs. segmented locks), null handling, and performance trade-offs.
7. Autoboxing Pitfalls
Explain Integer cache behavior (e.g., == vs. equals()). Discuss performance penalties for frequent unboxing.
8. Class Loading & Custom Class Loaders
Describe bootstrap/extension/application class loader hierarchy. Write a basic custom class loader to load classes from non-standard sources.
9. Fork/Join Framework
Implement parallel computation for tasks like array sum. Compare with ExecutorService and discuss work-stealing efficiency.
10. Phantom/Soft/Weak References
Explain reference types, JVM retention policies, and use cases (caching, memory-sensitive apps).