Member-only story
Core Java: Concept
Free User : CLICK HERE
ConcurrentHashMap Thread Safety
Modern versions (Java 8+) achieve thread safety using fine-grained synchronization with CAS (Compare-And-Swap) operations and synchronized blocks at the individual bin (bucket) level rather than locking the entire map. It only locks the specific node being modified during a hash collision, allowing concurrent reads and writes with high throughput.
wait() vs sleep() vs join()
wait(): Defined inObject; pauses thread execution, releases the monitor lock, and waits untilnotify()ornotifyAll()is called. Must be used within a synchronized block.sleep(): Defined inThread(static); pauses execution for a specified duration without releasing locks.join(): Defined inThread; pauses the current thread until the thread it was called on completes execution.
JVM Class Loading Mechanism
Operates through three primary phases adhering to a parent-delegation hierarchy (Bootstrap rightarrow Platform/Extension rightarrow Application ClassLoader):
- Loading: Reads the
.classbinary bytecode into memory and creates aClassobject. - Linking: Verifies bytecode correctness, prepares memory for static variables, and resolves symbolic references.
- Initialization: Executes static blocks and assigns initial values to static variables.








