I am executing following code in my programme
state=5;
for(;
{
System.out.println(state);
Thread.sleep(1000);
}
While the above code was getting executed another
thread Thread2 which has got access to the variable "state" changes the value of state to 10.
ow when the Thread1 returns for execution the code still prints out 5 instead of 10.
The thread still print 5 instead of 10 .
Why it's so ?