No, but kind of.
Inheritance just make sure whatever is in the superclass is in the subclass.
Interface ensures what methods must be available in the class. However any subclasses can have all the methods needed in the interface, when the superclass implements the interface and already have the required methods.
Abstract methods in abstract class is similar to interface where the method must be available in the subclass.
So for example if we have Pets
interface Pets { public int owningPrice(); }
Animal
abstract class Animal { public int age; public abstract void ageOfDeath(); public String toString() { return String.format("age :%d;", age); } }
Dog
class Dog extends Animal implements Pets { public void ageOfDeath() { System.out.println("ageOfDeath is 20"); } public int owningPrice() { return 1000; } }
and Shiba
class Shiba extends Dog { // yes this is empty }
if you declare the variables like so
Animal animal = new Shiba(); Shiba shiba = new Shiba();
and try to print out everything in the variables, it will become like this
animal age :0; ageOfDeath is 20 --- shiba age :0; owningPrice is 1000 ageOfDeath is 20
Notice that while both is instantiated using Shiba class, "shiba" has owningPrice, and "animal" doesn't since it is not a subclass of Dog and does not implement Pets.
Conclusion, subclass does not inherit interface, however if superclass implemented the interface, subclass is considered one of the interface.