Sobes.tech
Junior — Middle

What is the maximum number of abstract classes that can be inherited by a single class?

sobes.tech AI

Answer from AI

In Java (and consequently in Android), a class can inherit only one abstract class. Multiple inheritance of classes is not supported, including abstract classes. However, a class can implement multiple interfaces.

Example:

abstract class Animal {
    abstract void sound();
}

class Dog extends Animal {
    @Override
    void sound() {
        System.out.println("Woof");
    }
}

Here, the Dog class inherits from one abstract class, Animal.