【发布时间】:2014-10-08 20:14:43
【问题描述】:
package aaa;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
public class pear {
public class aaa extends Application{
@Override
public void start(Stage primaryStage){
Button okbt = new Button("ok");
Scene scene = new Scene(okbt, 200,250);
primaryStage.setTitle("n");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args){
Application.launch(args);
}
}
}
这是我的教科书为我提供的代码示例,我尝试运行它,但它无法运行。这是错误:
错误:在 aaa.pear 类中找不到主方法,请将主方法定义为: 公共静态无效主(字符串 [] 参数)。我不明白为什么它错了,因为主类在起始类之外,在扩展应用程序之内。这直接来自一本书,我只需要知道它为什么无法运行。
【问题讨论】:
标签: java