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
How do you remove duplicates in java?
What is the major difference between linkedlist and arraylist?
What is string pool in java?
What is the public method modifier?
What do you understand by abstract classes?
What is incompatible types in java?
How to print an arraylist in java?
how to write a program for sending mails between client and server
Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?
Which is better stringbuffer or stringbuilder?
Is there any tag in htm to upload and download files?
how do I create a runnable with inheritance? : Java thread
How to make a non daemon thread as daemon?
Difference between this() and super() in java ?
What is internal iteration in java se 8?