Sobes.tech
Junior — Middle

Is it possible to implement an interface through another interface?

sobes.tech AI

Answer from AI

Yes, in Java, an interface can inherit from another interface. This allows creating interface hierarchies and extending their functionality.

Example:

public interface Vehicle {
    void start();
}

public interface Car extends Vehicle {
    void openTrunk();
}

Here, Car extends Vehicle and adds a new method. Any class implementing Car must implement methods from both interfaces.