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 |
what are the application of compiler and interpreter for source program
Differentiate between stringbuffer and string?
What is replaceall in java?
why java does not have operator overloading?
What is procedure overloading?
How to overcome the exception object reference not set to an instance of object?
Distinguish method overloading and overriding
What is the main functionality of the remote reference layer?
Can we restart a thread already started in java?
What is :: operator in java 8?
how to java plateform independent?
How does split work in java?