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

How do you remove duplicates in java?

532


What is the major difference between linkedlist and arraylist?

514


What is string pool in java?

568


What is the public method modifier?

548


What do you understand by abstract classes?

605






What is incompatible types in java?

543


How to print an arraylist in java?

504


how to write a program for sending mails between client and server

1557


Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?

576


Which is better stringbuffer or stringbuilder?

533


Is there any tag in htm to upload and download files?

612


how do I create a runnable with inheritance? : Java thread

509


How to make a non daemon thread as daemon?

556


Difference between this() and super() in java ?

618


What is internal iteration in java se 8?

631