Often, you'd see the listener defined as an inline anonymous class.
通常,您会看到侦听器被定义为内嵌匿名类。
As an example, the code in Listing 1 USES an anonymous class to create a Thread Factory.
例如,清单1所示的代码使用一个匿名类创建了一个Thread Factory。
To implement this listener class, we'll code an anonymous class in the main Explorer Window.
为了实现该侦听器类,我们将在主资源管理器窗口中编码一个匿名类。
To pass this to a recursive method, the anonymous class should extend a wrapper type known to the method.
为了在递归方法中传递,匿名类应该扩展方法已知的包装器类型。
The code in Listing 1 would be much neater if the anonymous class was placed separately as an inner class.
如果这个匿名类可被作为一个内部类单独放置,那么清单1中的代码将会简洁很多。
If you add a method, all JRuby has to do is generate a new anonymous class that includes the body of that method.
如果你添加了一个方法,则所有JRuby要做的事情就是生成一个新的匿名类,该类包含了这一方法的方法体。
The closest you can come is to use a class (frequently an anonymous class) as a "holder" of a method you need to execute.
最接近的方式是利用类(经常是匿名类)作为想要执行的方法的 “holder”。
Since the "locals" used by an asynchronous functions are actually fields on an anonymous class, they must be retained for the duration of the call.
由于在异步函数中所使用的“局部变量”实际上是某个匿名类中的字段,因此在调用期间它们必须被保留。
If this takes several seconds, which is not uncommon for an asynchronous call, the anonymous class may be inadvertently promoted to the more expensive generation 1 or 2.
如果此过程耗时数秒,这对于异步调用而言是很常见的,而该匿名类可能在不经意间被晋升为垃圾回收器中更昂贵的1代或2代对象[3]。
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.
匿名类是一种语法速写标记,使您能够在需要实现某个抽象类或者接口的地方创建一个类的实例,而不需要显式提供类的名称。
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.
匿名类是一种语法速写标记,使您能够在需要实现某个抽象类或者接口的地方创建一个类的实例,而不需要显式提供类的名称。
应用推荐