How the threads are synchronized?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / dsr
By using wait(),notify and notifyall() methods in the code.
| Is This Answer Correct ? | 2 Yes | 4 No |
Does list allow duplicates in java?
What is the string function?
What is final int?
What about method local inner classes or local inner classes in java?
What is the difference between interpreter and compiling ?
Does java isempty check for null?
What is vector capacity in java?
I need help please send me reply: Write a program "if given a string like 'HAT', the combination's returned should be like ATH,THA,TAH in java"?
Explain the different forms of polymorphism?
What is integer valueof?
What does java stand for?
Why we use multi threading instead of multiprocessing?