wat is class level lock and object level lock

Answer Posted / ask

Class Lock - If a static method is marked as Synchrnozied
and called by a Thread, the whole Class will be locked
until the method execution completed.

Object Lock - If a non-static method is marked as
Synchronzied and called by a Thread, the current instance
(Object) will be locked util the method execution completed.

Is This Answer Correct ?    53 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain throw keyword in java?

617


Why stringbuilder is not thread safe in java?

578


Why to use nested classes in java?

592


who can i handle multiple client in RMI

1444


Why is singleton class used?

529






What are the types of arrays in java?

563


What is passing value java?

514


What is a treemap in java?

543


When we should use serialization?

572


What are accessor methods in java?

559


Which class is the superclass for all the classes?

536


If a method is declared as protected, where may the method be accessed?

538


What is the file type?

561


What are measurable parameters?

571


What is the abstraction?

596