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
What is the difference between math floor and math round?
What is the concept of multithreading?
What access modifiers can be used for methods?
What a static class can contains?
What is the use of set in java?
What is the functionality of the stub?
What is the purpose of the main method?
Can a singleton class be inherited?
Which eclipse is best for java?
What is size_t?
What is lazy initialization in java?
Explain the difference between collection api and stream api in java8?
Is 9 a prime number?
What are register variables what are the advantages?
What is a default constructor and also define copy contrucyor?