Sage Software Interview Question
Software Engineer / DevelopersIn general, interface has method declarations alone and no definitions. It can have static final members as well. (constant). Any class implementing this interface has to implement all the methods.
Abstract class on the other hand may have some methods which are implemented and some methods that are abtract. As opposed to interface, abstract class may have members which are not static and final. Any subclass of abstract class should implement the abtract methods of its super or it be declared abstract as well.
If abstract class has only abstract methods in it, it might as well be declared as an interface.
For the given example, there is no difference between functionalities for the two types. The behaviour is the same.
Abstract class can have method definitions, interface can not have method definitions
- Anonymous February 21, 2007