GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 6 of 921    Print  
Can a lock be acquired on a class
Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object..


  
Total Answers and Comments: 6 Last Update: April 21, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 26, 2005 02:05:15   #1  
Aditya        

RE: Can a lock be acquired on a class
we can get lock on the class's Class object by using "static synchronize". This is the most exclusive lock.
 
Is this answer useful? Yes | No
August 27, 2005 14:20:20   #2  
Ajay Rout        

RE: Can a lock be acquired on a class
In class level the most exclusive lock can be achieved by synchronising the class's class object and declaring it static.
 
Is this answer useful? Yes | No
September 09, 2005 17:44:10   #3  
ramesh        

RE: Can a lock be acquired on a class
Classes can not be locked straightaway. 
One can not tell  
 
public synchronized class classname 
{ } 
 
But objects can be synchronized, also methods can be synchronized

 
Is this answer useful? Yes | No
October 07, 2005 10:35:55   #4  
abhishekgowl@yahoo.co.in Member Since: October 2005   Contribution: 9    

RE: Can a lock be acquired on a class

Simply Locking a Thread means to do operation only at once you can Lock the Thread by simple put a keywork sychronize in the front of the method.

Like

Synchronize m1()

{


 
Is this answer useful? Yes | No
October 07, 2005 10:40:03   #5  
abhishekgowl@yahoo.co.in Member Since: October 2005   Contribution: 9    

RE: Can a lock be acquired on a class

Simply Locking a Thread means to do operation only at once you can Lock the Thread by simple put a keywork sychronize in the front of the method.

Like

Synchronize m1()

{


 
Is this answer useful? Yes | No
April 21, 2008 20:33:38   #6  
supari Member Since: June 2007   Contribution: 15    

RE: Can a lock be acquired on a class
Aditya
Pls write code and explain

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape