No enclosing instance of type SocketServerTest is accessible. Must qualify the allocation with an enclosing instance of type SocketServerTest(e.g.x.new A() where x is an instance of SocketTest).
在做Socket和ServerSocket测试的时候. 服务端中,定义类里面嵌入了一个内部线程类,进行调用.结果报上面的错误. 原因是:main方法是static方法,调用内部类时,也需要是static类型才可以. 所以在定义的内部线程类中的声明中,需要添加关键字static. |
|