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 |
Is it possible to write a regular expression to check if string is a number?
What is java beans?
What is the purpose of having the concept of overloading?
What is exception propagation?
What is difference between add() and addelement() in vector?
Tell us something about an iterator.
How do you clear an arraylist in java?
What is generic type?
Can Java be said to be the complete object-oriented programming language
int a=1,b=10; System.out.println(a+b--);
why marker interfaces are there in java
What is cloneable interface?