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  >  Core Java

 Print  |  
Question:  how and when to prevent inheritance?



January 01, 2006 05:22:22 #2
 Suvendu Kumar Barik J2EE Expert  Member Since: January 2006    Total Comments: 27 

RE: how and when to prevent inheritance?
 

One can prevent inheritance by declaring a class with keyword final  .By declaring a class as final no other class can extend it..

final class Example

{

/*  

     Code   for u r application..

*/

}

     

 

Back To Question