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 the function of compareto in java?
Why javac is not recognized?
What is default constructors?
Why is static used?
Explain about data types?
Garbage collection in java?
What is the purpose of an interface?
Q1.A. Write note on “The class path Environment Variable”? B. Which are different kinds of source code? Q2.A. How to create an interface? B. Why convert an applet to an application? Q3.A. How to use Media tracker Class. B. How to use string tokenizer class. Q4 A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on “The properties class” Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites.
What is substring 1 in java?
What is java regex?
What is function and method in java?
Difference between association, composition and aggregation?
What is size_t?
What is the difference between static and non-static variables in java programming?
Why string is immutable with example?