如果这个匿名类可被作为一个内部类单独放置,那么清单1中的代码将会简洁很多。
The code in Listing 1 would be much neater if the anonymous class was placed separately as an inner class.
相比于每个匿名内部类都要对应一个类的做法来说,这种方式是个极大的改进,同时也使得代码的可读性更好。
This is an improvement over having to write a class any time an anonymous inner class is needed and can help keep the code more self-documenting.
我以前可能提到过,您将经常看到定义为匿名内部类的asynccallback类。
As I probably mentioned before, you'll frequently see AsyncCallback classes defined as anonymous inner classes.
应用推荐