我刚刚开始使用Akka框架,并在documentation中看到以下代码片段。有人可以解释这段代码吗?是否允许在Java中声明顶级类为静态
它允许声明顶级类为静态吗?我发现了similar问题。它表示顶级类不能在Java中声明为静态,但在本例中顶级顶级代码已声明为静态!我错过了什么?
static class MyActorC implements Creator<MyActor> {
@Override public MyActor create() {
return new MyActor("...");
}
}
Props props2 = Props.create(MyActor.class, "...");
Props props3 = Props.create(new MyActorC());
是。但是如果这个例子正确地缩进了,并且显示了封闭的类声明,这将会有所帮助。 –