Answer Posted / seshadri pera
Threads are synchronized in two ways.
1) block level
2) Method level
Block level synhronization is the better performance
compare to method level.
Block Level:
see the code syntax for block level
synchronized {..
....//code to lock the specific object here..
...}
Method Level:
See the syntax
public void synchronized XXXMethodName(Parameters or
object to acquire locking){.....
...}
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
what is a green thread? : Java thread
What is finally in Java?
What is runtime polymorphism or dynamic method dispatch?
What is an enumeration?
What is the exact difference in between unicast and multicast object? Where we will use?
Is object a data type?
What do you mean by static variable?
What is an anonymous class in java?
What is java used for on a computer?
How many types of java are there?
What are thread priorities and importance of thread priorities in java?
Are strings immutable in java?
Is it possible to override private or static method in java?
what are abstract functions?
What are encapsulation, inheritance and polymorphism?