Woodstock Blog

a tech blog for general algorithmic interview questions

[Java OOP] Interface Extend Another Interface

Can an interface extend another interface in Java?

Yes. Just remember that you should implement the methods in both interfaces.

Example in Java source code link1, link2:

public interface List<E> extends Collection<E> {

}

public interface Collection<E> extends Iterable<E> {

}

In conclusion, ref

An interface can extend multiple interfaces.

A class can implement multiple interfaces.

However, a class can only extend a single class.

a special case

interface A
{
    void test();
}

interface B 
{
    void test();
}

class C implements A, B
{
    @Override
    public void test() {

    }
}

Well, a single implementation works for the both methods. This implementation works no problem.