Originally posted by chaohua wang:
I think static method also has only one in memory, can not make a copy for the threads.
In general, there is only ever a single copy of the code for
any method, static or not (barring complications like multiple class loaders, which we'll ignore for the moment.) But this does not stop multiple threads from using that code at the same time, any more than you and a friend have any problem both looking out a single window at the same time.
Only the "synchronized" keyword can mark a method so that only one thread can use it at a time.