我有这个代码
public class watermark {
public static void main(String[] args) {
wmmain m = new wmmain();
m.setSize(800, 500);
m.setVisible(true);
}
class wmmain extends JFrame /* MAIN WINDOW */
{
JMenuBar jmb;
// ......
}
}
它在命令提示符下工作正常,但是当我尝试在 eclipse 中运行代码时,它给了我以下错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
No enclosing instance of type watermark is accessible. Must qualify the allocation with an enclosing instance of type watermark (e.g. x.new A() where x is an instance of watermark).
at watermark.main(watermark.java:20)
我该怎么办??