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
Why is inheritance used in java?
What is garbage collector?
Which java version is latest?
What is a nested class?
What is parse method?
What is run time allocation?
What is the range of the short type?
How do you trim a space in java?
Why do we create threads in java?
Can list have duplicates in java?
how we can make a write-only class in java?
What are the differences between heap and stack memory in java?
What do you mean by append?
Is null a string in java?
What is threaded programming and when is it used? : Java thread