Hi Friends, I am beginner in java. what i know about
synchonized keyword is,If more that one 1 thread tries to
access a particular resource we can lock the method using
synchronized keyword. Then after that how the lock is
released and how next thread access that.Please explain with
example.
Answers were Sorted based on User's Feedback
Answer / ejp
The lock is released when the holding thread exits the
synchronized block.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / ejp
Throwing the exception exits the synchronized{} block so
that answer doesn't actually add anything.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ravikiran
The lock will be released & allocation depends on the scheduler
| Is This Answer Correct ? | 0 Yes | 3 No |
Can we overload final method in java?
Can we have multiple classes in single file ?
What are legal modifiers that we can use to declare an inner class?
Why do we need autoboxing in java?
Map map = new HashMap(2); map.add(“1”,”one”); map.add(“2”,”two”); map.add(“3”,”three”); What will happen at this line?
Is sizeof a preprocessor?
What is the difference between add() and addElement() method in Vector Class ?
what is the main differene between synchronize() method and Synchronize{}block?
What does a method signature consist of?
What is data object example?
What are the skills required for core java?
What is Java Annotations?