Why java provide facility to declare interface inside interface

interface, java

Solution

This enables you to put the sub interface in a namespace that might make more sense than a different package. A good example of this from the Java API is the `Map.Entry` interface. An `Entry` only really makes sense in the context of something implements the `Map` interface, so it is defined as an interface inside an interface.

Note that other than with inner classes, inner interfaces are always static, as Jesse Glick mentions in his answer to a related question.

Problem

I am trying different combination of inner classes.I wonder that java gives you facility to write interface inside interface.It does not give me any compile time error. Can anybody tell me what is the use of this ? ``` public interface IA { public interface IB{ } } ```

Original source

Related problems