What are the two ways you can synchronize a block of code?
Answer Posted / ajay tiwary
The way you can synchronize the block is:-
synchronized(dummy object)
{
//synchronized statement
}
In dummy object you can use this or u can create a dummy
object by using new Keyword.
What answer Vikki is posted as the first one is not the way
of synchronizing the block but it's a way to synchronizing
a method.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
Why stringbuffer is faster than string?
What does mean in regex?
What is the significance of java packages?
Explain the difference between the public, private, final, protected, and default modifiers?
What is the tradeoff between using an unordered array versus an ordered array?
Can a class have multiple subclasses?
Can we use String with switch case?
What is update method called?
what is thread? What are the high-level thread states? : Java thread
What are reference variables in java?
What is general methodology?
Explain the difference between throw and throws in java?
Can list be null in java?
What are static blocks and static initalizers in java ?
Why is it important to initialize a variable?