public class hello {
static class hello1 extends Thread {
public hello1() {
}
public hello1(String name) {
this.name = name;
}
public void run() {
for (int i = 0; i < 5; i++) {
System.out.println(name + "运行 " + i);
}
}
public static void main(String[] args)
{
hello1 h1=new hello1("A");
hello1 h2=new hello1("B");
h1.run();
h2.run();
}
private String name;
}
}
错误信息如下:
错误: 在类 hello 中找不到 main 方法, 请将 main 方法定义为:
public static void main(String[] args)
否则 JavaFX 应用程序类必须扩展javafx.application.Application
——————————————————————————————————————————————————————————————————————
多谢各位!还有个问题,如果把hello1这个thread类的 static去掉,主函数中就找不到它了,必须加static是吗?