Originally posted by srikanth reddy:
if the variable is declared as volatile then the it means that each thread will have a copy of that variable ......
thanks & regards
srikanth reddy
Actually the volatile meaning is oposite. Volatile variable does have only one master copy and threads access it directly.
Non-volatile variables may or may not (depends on JVM) have a private copy for each thread. The private copies are synchronized with the master copy only at certain points.