Abimaran Kugathasan wrote:
There are two invocation of method on a single instance, and there are two threads. But, in the second case, you've only one invocation
how is the two invocation or single invocation tend to affect the program ?
setNumber and
getNumber are
synchronized and so is the
increase method,then
why there occurs a context switch.once a thread gets a lock,it calls getNumber method,it releases the lock then again obtains the same lock and calls setNumber ?
How is it possible for the other thread to come in between ??
basically,i am not able to get why there is a context switch ??