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 meta-annotations?
What is the difference between sleep and wait in java?
Explain when classnotfoundexception will be raised ?
How do you define a variable?
what questions are been asked ??? for interview in apti
What is Collections API?
What are the advantages of unicode?
Say any two properties in beans?
What mechanism does java use for memory management?
How many bytes is a string?
Can we iterate through collection using for loop?
What is the differences between heap and stack memory in java? Explain