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
Is static a keyword in java?
what is a green thread? : Java thread
What are the benefits of operations?
What are methods and how are they defined?
Is java util list serializable?
What is the size of a string in java?
What are the 4 types of research methods?
What is a text string?
Can constructor be synchronized?
What does s mean in regex?
What is the difference between && and & in java?
In the below example, how many string objects are created?
What is the use of static methods?
What is the difference between equals() and == in java?
What is the difference between an inner class and a sub-class?