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 the purpose of main function in java?
Explain the reason behind ending a program with a system.exit(0)?
What are different types of references?
Is jdk required on each machine to run a java program?
What is the purpose of lambda expressions?
What are invisible components?.
What is private public protected in java?
What are the types of methods in java?
Where is singleton pattern used?
What is the java reflection api? Why it’s so important to have?
Which list does not allow duplicates in java?
What is the use of join method?
Explain the importance of finally block in java?
What are 3 data types?
What is the longest unicode character?