Sponsored Link •
Caninehas one method,
howl(), that is abstract
Canineis an abstract class, then expect subclasses like
Canineis an interface, then could get implementations like
It's really a tight-knit family thing. In the Java programming language, people can always use inner classes, which is a short hand of using composition, to get around multiple inheritance of implementation. If it feels more like a small family, go for the abstract class.
You force Canines into the Canine inheritance hierarchy. You limit client choices. What you are saying is that class Canine is a more narrow idea than interface Canine. If you use an abstract class, you are saying the concept is much more narrow, an interface, much more broad.