java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.
偶不懂这个,看这个错误信息好象显示主函数有问题?
〖求助〗java的编程问题
java的编程问题import java.awt.*;
import java.awt.event.*;
public class TestButton{
public static void main(String args[]){
Frame f=new Frame("Test");
f.setSize(200,200);
f.setLayout(new FlowLayout(FlowLayout.CENTER));
Button b=new Button("press me");
b.addActionListener(new ButtonHandler());
f.add(b);
f.setVisible(true);
}
}
class ButtonHandler implements ActionListener{
public void actionPerformed(ActionEvent e){
System.out.println(e.getActionCommand());
}
}
编译通过了,为什么不能运行,请教下大家,
--------------------Configuration: <Default>--------------------
java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.
这是出错的原因 路过。。。 缺少主语句
应该是要再后面或者前面加个
main()语句把,详细的方式参考JAVA的书吧,
这段代码中LZ定义了一个CLASS和一个LISTENER
缺少运行该CLASS的必要函数
页:
[1]