The most important benefit

The most important benefit of anonymous classes has to do with accessing the members of enclosing classes.

As with member classes and local classes, methods of an anonymous class have direct access to all the members of the enclosing classes, including private members.

The use of anonymous classes can often eliminate the requirement to connect objects together via constructor parameters or callbacks.

File: al.htm [Next] [Prev]