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
Why is string buffer better than string ?
List some important characteristics on jre
What is java life cycle?
explain the concept of virtual method invocation in polymorphism in detail?
Is java ee a framework?
Explain about anonymous inner classes ?
What is the difference between throw and throws in java?
Can main() method in java can return any data?
What is the purpose of the file class in java programming?
What does this mean java?
How do I convert a string to an int in java?
What is the purpose of static keyword in java?
Why isn’t there operator overloading?
How do you compare two objects?
How does multithreading take place on a computer with a single cpu in java programming?