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 a class component?
What is difference between == and === in js?
Name some classes present in java.util.regex package.
Can static methods access instance variables in java?
What is java util list?
What is finalize()?
Should database connections be singleton?
what are the states associated in the thread? : Java thread
What is boolean strategy?
Differentiate between a class and an object.
What are dot operator queries?
Differentiate between nested and inner class in java.
How can we find the actual size of an object on the heap?
What is ascii format?
Why does it take so much time to access an applet having swing components the first time?