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
Explain the significance of class loaders in bootstrap?
What is anagram number?
Explain the significance of listiterator.
Is minecraft 1.15 out?
What is replacefirst in java?
How to pass arraylist to stored procedure in java?
What is the use of set in java?
What is class variable java?
Difference between string s= new string (); and string s = "abv";?
What are streams?
What is a stack class in java ?
What is return data type?
Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
Is final static java?
What is executor memory?