Originally posted by Krishna Rao:
What is the meaning of
synchronized(someobject){
}
Does it mean only thread is supposed to access someobject's fields and methods ?
This means that one one thread at a time can run the statements within the block and the lock of someobject will be acquired before executing the statements and after the execution the lock is released.