I am trying to understand the concept of ThreadLocal
concept in Java and I am bit confused.
For example, to define the task of thread we do like this:
public void run() {
int sum = 0;
// Code which a thread executes
}
So, if we created say 6 threads, won't each thread have its own "sum" variable as local?
If this is not the concept of ThreadLocal
, am i missing something in understand this concept.
Can anyone help me understand this?