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  >  OOPS

 Print  |  
Question:  What is the need of an abstract class?

Answer: If I write all of concrete methods in one class and all abstract methods in an interface and extend and implement both in third class assume that third class don't extend any other class?


August 08, 2008 12:02:07 #4
 alkumar2000   Member Since: August 2008    Total Comments: 5 

RE: What is the need of an abstract class?
 
Abstract is most useful when you are creating a framework..take the example of template method pattern which is used in the templates provided by spring framework for the support of jdbc or hibernate it absrtacts out all the common things which needs to be done in the templates that it provides the only thing now the developer has to do is to extend these classes create and execute the query.The develepor here doesn't need to worry to get the connection and close the connection.
     

 

Back To Question