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
Can we use a switch statement with strings?
we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.
What are the differences between checked exception and unchecked exception?
Why is the main method declared static?
What is a programming object?
What is anti pattern in programming?
What is the this keyword?
Is constructor inherited?
Why is singleton instance static?
How to read and write image from a file ?
What is thread safe java?
How many bits is a string in java?
What do you mean by checked exceptions?
What is treeset in java?
What must a class do to implement an interface in java programming?