Inner Classes

Inner Classes

class OuterClass {
    ...
    class InnerClass {
        ...
    }
}

As with instance methods and variables, an inner class is associated with an instance of its enclosing class and has direct access to that object's methods and fields. Also, because an inner class is associated with an instance, it cannot define any static members itself.

Objects that are instances of an inner class exist within an instance of the outer class. An instance of InnerClass can exist only within an instance of OuterClass and has direct access to the methods and fields of its enclosing instance.

Inner Classes — Structure map

Clickable & Draggable!

Inner Classes — Related pages: