
what is the diffrenece between class level locking&object level locking,explain with examples

A class level lock is the lock which makes all object of a class to wait until the corresponding lock is not released.
e.g Class A{ static synchronized void foo(){} }
Here the method foo is synchronized and hence all the threads on all the objects of the class will wait until the object currently running the foo method completes its execution.
An object level lock makes all the threads started using the instance of the class to wait until the lock is not released.
e.g. Class A{ synchronized void bar(){} }
Here all the threads started from the object which is currently executing the bar method will wait until the current threads completes its execution. Note that other threads of other objects can execute the bar method while another object's thread is executing the bar method.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.