Java Interview Questions

BY Author

Java – Nested interfaces

An interface defined inside another interface or a class is known as a nested interface.

By default interface is public when it is defined inside another interface.Java doesn’t allow using private or protected access modifiers with interface when it is nested inside another interface.Java allows using any access modifier with interface when it is nested inside another class.

To access the nested interface outside the interface or a class, it must be used with a name of the interface or a class in which it is nested.

It’s like using child name along with its parent’s name to recognize to whom does child belongs.