main()方法的疑问?
public class test extends Frame
{
public static void main(String args[])
{
test d = new test()
d.setSize (400,400);
d.setVisible (true);
d.addWindowListener(new WinListen(this));
}
}
class WinListen implements WindowListener
{
//以下代码省略
}
编译时,系统提示"在静态上下文中,不能引用非静态变量this"是什么原因?
还有,就是在main方法中,能否引用类中的全局变量?main()方法里面的代码除了接收参数外,主要还初始化一些什么对象?