When to use an Interface and abstract class in Java? I've searched stackoveflow and came up with this answer. However, I'm unable to understand it without an example. Can someone help me with this?
interface: To implement a contract by multiple unrelated objects. When you want polymorphic behaviour for classes which are completely unrelated, use an interface
abstract class: To implement the same or different behaviour among multiple related objects. When you want to provide polymorphic behaviour in an inheritance hierarchy, use abstract classes.