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
What is static block?
What is var keyword ?
Explain about oops concepts.
How does compareto work in java?
Can we have try without catch block?
When does a class need a virtual destructor?
Difference between abstract and concrete class ?
What is java util function?
What is java dot?
What is linkedlist in java?
What is the use of isempty in java?
What is the difference between stream and buffer?
Why is boolean important?
What happens if an exception is not handled in a program?
What is advantage of java?