What is the need of an abstract class?

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?

Showing Answers 1 - 12 of 12 Answers

Providing the Abstract functionality to object is one of the powerful concepts by java, I will give you one sample scenarios where you required implement the abstract class,

 

Assume that you are going to design TV remote (in real time it will be your client business) with 100 new functionalities in it but you know only 30 functionalities to implementation at this moment. So you will provide implementation for 30 method and rest of 70 methods are abstract. When ever new class extends it, it should be implement rest of 70 methods.

sampra

  • Feb 13th, 2008
 

If we have some method which body is not defined till declartion of class and body is implemented in subclass later then declare that class as abstract class.If a class has atlest one abstract method then we have to declare class as abstract class

  Was this answer useful?  Yes

alkumar2000

  • Aug 15th, 2008
 

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.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions