Sitemap

Member-only story

Core Java: Concept

2 min readSep 7, 2026

--

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 in Object; pauses thread execution, releases the monitor lock, and waits until notify() or notifyAll() is called. Must be used within a synchronized block.
  • sleep(): Defined in Thread (static); pauses execution for a specified duration without releasing locks.
  • join(): Defined in Thread; 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):

  1. Loading: Reads the .class binary bytecode into memory and creates a Class object.
  2. Linking: Verifies bytecode correctness, prepares memory for static variables, and resolves symbolic references.
  3. Initialization: Executes static blocks and assigns initial values to static variables.

--

--