nested interface in Java

We can declare interfaces as member of a class or another interface. Such an interface is called as member interface or nested interface.
* Interface in a class. Interfaces or classes can have only public and default access specifiers when declared outside any other class. A interface declared in a class can either be default, public, protected not private. While implementing the interface, we mention the interface as class_name.interface_name where class_name is the name of the class in which it is nested and interface_name is the name of the interface itself.
```
import java.util.*;

class Test {
    interface Show {
        void show();
    }
}
  
class Testing implements Test.Show {
    public void show() {
        System.out.println("show");
    }
}
  
class Main {
    public static void main(String[] args) {
        Test.Show ts = new Testing();
        ts.show();
    }
}
```
* Interface in another interface. An interface can be declared inside another interface also. We mention the interface as outter_interface_name.inner_interface_name where outter_interface_name is the name of the interface in which it is nested and inner_interface_name is the name of the interface to be implemented. Notice the access specifier of interface in another interface is public even if we have not written public. If we try to change access specifier to anything other than public, we get compiler error. Remember, interface members can only be public.
```
import java.util.*;

interface Test {
    interface Show {
        void show();
    }
}
  
class Testing implements Test.Show {
    public void show() {
        System.out.println("show");
    }
}
  
class Main {
    public static void main(String[] args) {
        Test.Show ts = new Testing();
        ts.show();
    }
}
```