wat is class level lock and object level lock

Answer Posted / sitaram

class StringSample{
static void method1(){
System.out.println("classlevel...");
}
void method2(){
System.out.println("object level...");
}

}
public class StringDemo{
public static void main(String[] args) {
StringSample.method1(); // class level
// StringSample.method2(); //error
StringSample s2 = new StringSample();
s2.method2(); //object level

}
}

Is This Answer Correct ?    8 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between math floor and math round?

499


What is the concept of multithreading?

520


What access modifiers can be used for methods?

555


What a static class can contains?

694


What is the use of set in java?

610






What is the functionality of the stub?

569


What is the purpose of the main method?

538


Can a singleton class be inherited?

523


Which eclipse is best for java?

519


What is size_t?

501


What is lazy initialization in java?

550


Explain the difference between collection api and stream api in java8?

506


Is 9 a prime number?

464


What are register variables what are the advantages?

444


What is a default constructor and also define copy contrucyor?

595