Nested and Inner Classes

    You can also use interfaces with nesting. All combinations of classes and interfaces are possible: You can nest interfaces in classes, classes in interfaces, and interfaces in interfaces.

    See Qualified this expressions to learn about disambiguation of this in inner classes.

    Anonymous inner classes

    Note: on the JVM, if the object is an instance of a functional Java interface (i.e. a Java interface with a single abstract method), you can create it using a lambda expression prefixed with the type of the interface: