What are the two ways you can synchronize a block of code?
Answer Posted / vikki
There are two ways to syanchronize access to an object
1st one is using synchronized keyword for example
Synchronized type methodname(arg-list)
{
//synchrinized method body
}
2nd way s using synchronized block
synchronized(object)
{
//synchronized statement
}
| Is This Answer Correct ? | 30 Yes | 0 No |
Post New Answer View All Answers
How to reverse a string in java?
What is assembly language?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
What is the difference between iterator and enumeration ?
Tell me how many ways are there to initialise an integer with a constant.
What does three dots mean in java?
Explain scope or life time of local variables in java?
What is the final variable?
Why is core java important?
How do you create a null object?
What do you mean by light weight and heavy weight components?
What is a pattern what is an anti pattern?
What is fundamental datatype?
What is thread pool in java with example?
How to split a string in java?