1 | A local class is defined within a block a Java code, typically a method, but also static and instance initializers. |
2 | The local class is only visible within the block of code in which its defined. |
3 | It can use any final (can't be overriden by subclass) local variables or method parameters within its scope. |
4 | Syntax: just declare the class and use it entirely within one block, such as a method. (Note that use of "final" modifier is liberalized.) |
5 | Unlike member classes, local classes can refer to local variables of block they're defined in. |
6 | Typical use of local classes is to define "event listeners". |
7 | There are also anonymous local classes, introduced without a name. Special syntax not covered here. |