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
What is a class reference?
Explain creating threads by implementing runnable class?
What is the purpose of main function in java?
What is an escape character in java?
What is reverse function?
What is the difference between pass by reference and pass by pointer?
What is a class object?
What is difference between fail-fast and fail-safe?
What is abstract class? Explain
What are selection structures?
Give an example of call be reference significance.
What is identifier give example?
What is string array?
Is it possible for a yielded thread to get chance for its execution again?
What is a text string?