我有以下代码:
public class MyClass {
class Inner {
int s, e, p;
}
public static void main(String args[]) {
Inner in;
}
}
到目前为止,代码没问题,但我无法在主方法中实例化 "in",例如 in = new Inner()
,因为它显示 非静态字段不能在静态上下文中引用
。
有什么办法可以做到这一点吗?我不想使我的 Inner
类成为 静态的。