This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Interface Vs. Abstract Class
Posted by Siva Jasthi on November 06, 2000 at 1:07 PM
(1) In the case of abstract class, you know the class hierarchy in advance.
You can only create sub-classes to the abstract class. But you can not make
any existing class (from other branch of the class tree) to implement the abstract
(2) Where as in the case of Interface, you can make ANY class in the hierarchy
to implement the interface. The interfaces are Java Way of providing
the multiple inheritance feature. If a class implements multiple
interfaces, then we are forcing the class to implement different behaviours
defined in the interfaces.
> What is the key difference between interface and abstratclass in practical.
> Theoritically abstractclass is partially implemented class where as methods in an interface doesT contain method def.
> My question is practically where can we use interface and where can we use abstract class.
> if any one can explain with an example it would be great