Swapnil Mishra wrote:Nesting Interface inside a Class and Nesting Class Inside an Interface
what is the real use of these ? can someone tell me if there are any real use cases in production scenarios where we nest a class inside an interface and vice-versa ?
A Map is a collection of name/value pairs. Map.Entry, defines an internal class or interface to contain a pair instance.
Smalltalk defines a generic Pair class, incidentally. I've often lamented that Java does not.
There are certain cases where an internal class was brought out for public use, though I cannot recall specifics. Most of that sort of kinkiness tends to have happened in GUI classes, and some cases have been simplified into stuff like lambdas these days, but for a long time, inner classes and anonymous inner classes were the bane of many a developer's existence.
JavaServer Faces uses a FacesMessage class to define the value and context of messages to be presented on the web page View. FacesMessage has an internal static class that defines the various message severity levels.