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



Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thre..

Answer / ejp

The lock is released when the holding thread exits the
synchronized block.

Is This Answer Correct ?    3 Yes 0 No

Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thre..

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

Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thre..

Answer / jitu

The lock is released when the holding thread exits the
synchronized block or an exception is occurred in execution.

Is This Answer Correct ?    0 Yes 0 No

Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thre..

Answer / jitu

ok i agree with u ejp

wat abt this ??

thread invokes wait() method..

is holding remains in synchronized block or it exists.

Is This Answer Correct ?    0 Yes 0 No

Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thre..

Answer / ravikiran

The lock will be released & allocation depends on the scheduler

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More Core Java Interview Questions

What is bean? Where it can be used?

0 Answers  


Explain about static nested classes in java?

0 Answers  


Explain exception chaining in java?

0 Answers   Cyient,


Can you make an instance of an abstract class?

5 Answers   Accenture,


What is merge sort in java?

0 Answers  






Is void a return type?

0 Answers  


Describe method overriding

0 Answers  


What is string args [] in java?

0 Answers  


What is the difference between array and array list in java?

0 Answers  


whats the diff between jsp and servlets?

9 Answers   HCL, TCS,


How many bytes is a string in java?

0 Answers  


Does java support multiple inheritance or not?

0 Answers   Hexaware,


Categories