Prev Next

Java / Java ThreadLocal

Difference between ThreadLocal class and volatile keyword in Java.

Both are completely unrelated.

The ThreadLocal class stores a variable in the Thread object of the current running thread, each thread gets its own copy of ThreadLocal instance, the ThreadLocal instances are not shared among the Threads.

Volatile keyword instructs the compiler that this variable be accessed/shared across multiple threads.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Java Multithreading

Comments & Discussions