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 |
What happens when main () method is declared as private?
What do you mean by stream pipelining in java 8?
What is the use of ?this??
Explain java heap space and garbage collection?
difference throws and throw in java
explain multi-threading in java?
What is difference between public static and void?
How many types of packages are there in Java?
What is the difference between parameters and arguments ?
What is boolean data type in java?
What are the two types of java?
Can we access a database using applets?