~/ learn/ java-from-zero/ cards/ Nested types: static nested, inner, local & anonymous
1 of 4

Type an inner class and create it from an outer instance

Type an inner class and create it from an outer instance

Answer

Button.ClickHandler h = b.new ClickHandler();

Inner class instances require an enclosing outer instance. The unusual b.new ClickHandler() syntax passes that outer instance. Static nested classes use the normal new Graph.Edge() syntax without an outer instance.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/8fa37489-d406-4464-b339-c068afe9014a/flashcard utf-8 LF