An anonymous class is a kind of syntactic shorthand that lets you instantiate a class implementing an abstract class or interface where you need it, without having to explicitly give it a class name.
匿名类是一种语法速写标记,使您能够在需要实现某个抽象类或者接口的地方创建一个类的实例,而不需要显式提供类的名称。
JUnit users will immediately note that this class lacks much of the syntactic sugar required by previous versions of JUnit.
JUnit用户会立即注意到:这个类中没有了以前版本的JUnit中所要求的一些语法成分。
They allow you to concisely define behavior that has wide-ranging impact with very little syntactic hangover in the target class.
您可以通过它们精确地定义有较广影响而在目标类中有较少语法残留的行为。
应用推荐