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

 Print  |  
Question:  Can a lock be acquired on a class

Answer: Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object..


October 10, 2005 10:35:55 #4
 abhishek J2EE Expert  Member Since: October 2005    Total Comments: 8 

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()

{

     

 

Back To Question