- Key Technology
In Java classes may be defined in the internal method, called local inner classes. This class can not use public, private modification, his role is limited to the method in the life of this class. One advantage compared to other classes of partial internal inner classes, parameters that can access a local inner class method.
Note: The method parameters are used in the internal local class must be final.
- Experience
Since the local interior Foreigners are not visible, so better to use anonymous inner classes instead. Only when the need to define the class constructor or override, or a plurality of objects of this class if necessary, it is recommended to use a local inner classes.
Reproduced in: https: //www.cnblogs.com/cglib/p/10672700.html