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
How do you sort a list in java?
What is the impact of declaring a method as final?
What is serialization in java?
Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; its length must be in between 8 to 20.
What are the six ways to use this keyword?
how to create daemon thread in java?
What classes of exceptions may be thrown by a throw statement?
What is downcasting?
Does java linked list allow duplicates?
What things should be kept in mind while creating your own exceptions in java?
What is the default size of set in java?
What is integer parseint?
What is the purpose of finalization in java programming?
What is static method with example?
What is a superclass?