可能重复:
Why do I get “non-static variable this cannot be referenced from a static context”?非静态类不能从静态上下文中引用
这里是代码
public class Stack
{
private class Node{
...
}
...
public static void main(String[] args){
Node node = new Node(); // generates a compiling error
}
}
错误说:
非静态类节点不能从静态上下文
在我的main()方法为什么不应该参考节点类引用?
“节点”应该*不*是一个内部类“堆栈”的。恕我直言... – paulsm4
@ paulsm4为什么不呢? – anthropomorphic