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
When the constructor of a class is invoked?
What does pointer mean?
What is the use of singleton class?
Can we change the value of static variable?
if u open login & logout ,how can udisplay the timelogin & logout members ?
What is difference between == and === in js?
String class is defined under which package in java?
Define an enumeration?
Explain the difference between comparator and comparable in java?
Do I need to import java.lang package any time? Why?
What is pojo class in java?
Where pragma is used?
What is == mean?
what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent
Can we define constructor in inner class?