How is the output in the above code coming to be 0,2,4,6,8,10,12,14,16,18,20,22
I think it shld be something like 00,22,44,66,88,1010. but how is it managing to go beyond 6 iterations?? there is one object made of inner class and it is Given to two seperate threads, they are both attacking 1 run() method. so the variables shld be shared. I can understand that the variable x is being shared for both threads, but how is the variable in the for loop 'i' being reset after the first
thread has finished its run()? Its not even like the run() is synchronized.