Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


wat is class level lock and object level lock

Answers were Sorted based on User's Feedback



wat is class level lock and object level lock..

Answer / ask

Class Lock - If a static method is marked as Synchrnozied
and called by a Thread, the whole Class will be locked
until the method execution completed.

Object Lock - If a non-static method is marked as
Synchronzied and called by a Thread, the current instance
(Object) will be locked util the method execution completed.

Is This Answer Correct ?    53 Yes 5 No

wat is class level lock and object level lock..

Answer / michael selvan

Class Lock - If a static method is marked as Synchrnozied
and called by a Thread, the whole Class will be locked
until the method execution completed.

Note : If we declare as a any static variables or methods
those will be stored in class area. So, if the method is
synchronized static . It'll lock the complete class.

Is This Answer Correct ?    4 Yes 0 No

wat is class level lock and object level lock..

Answer / 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

More Core Java Interview Questions

What is a java object and java application?

0 Answers  


How to use scanner in java?

1 Answers  


What is Runtime class and its purpose?

2 Answers  


Where is const variable stored?

0 Answers  


we cannot create an object of interface but we can create a variable of it

1 Answers  


What is final method?

0 Answers  


What is difference between “==” and equals()?

1 Answers   IBM,


what is thread? : Java thread

0 Answers  


What is the purpose of the file class in java programming?

0 Answers  


What is supplier in java?

0 Answers  


What are user defined exceptions?

0 Answers  


What do heavy weight components mean in java programming?

0 Answers  


Categories