Interface and Abstract Class Usage

When will you use an interface and abstract class?

Questions by Nishapanicker

Showing Answers 1 - 3 of 3 Answers

Abstract class is used when you expect lots of addition of methods in the later stages of your design. So that you can add methods without a change in subclasses that inherits the abstract class.

Interface is used when you want to implement the methods in different way in each class that implements the interface. For example a CAR interface with method speed can be implemented differntly in FORD, SKODA that implements the CAR interface.

the simple way we can answer is in interface we can provide only abstract methods(i.e the methods with out any implementation) and in abstract class we have abstract methods as well as concreate methods (i.e methods with implementation) but abstract class cannot have multiple inheritance concept where as interface have multiple inheritance in java.

  Was this answer useful?  Yes

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