|
Just adding, interfaces in most java literature are often considered as a capability to be able to do things, so implementing interfaces doesn't exactly the same as inheriting the method of a superclass, since in an interface, the method does nothing, only declaration in the form of abstract method
Some problem that occur when using multiple inheritance (according to some references), if classA and classB got the same method name test() but do very diffrent things, and then classC inherits both of the class but does not override the method test(), when an instance of classC would call the method test() it would be a problem to decide whether the instance would use the classA's test() or classB's test()
Interface is an abstract class, so the class that implements the interface must override the method that it inherited, thus, preventing the multiple inheritance problem above
Another advantages of using interfaces are the availability to use polymorphism to these classes, even if they don't relate at all
|