Java-Nested Interfaces

Nested Interfaces

An interface can be declared a member of a class or another interface. Such an interface is called a member interface or a nested interface. When a nested interface is used outside of its enclosing scope, it must be qualified by the name of the class or interface of which it is a member.

Program

0

Program Source

class Interface {
    
    interface InterfaceOne{
        
        void call();
    }
}

class Test implements Interface.InterfaceOne {
    
    public void call()
    {
        System.out.println("call method called");
    }
}

public class Javaapp {

    public static void main(String[] args) {
        
        Test f = new Test();
        f.call();
    }
}

Leave a Comment