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);
}
}
}
这是我的教科书对我的代码示例,我试图运行它,但它不会运行。这是错误:不让我运行应用程序
Error: Main method not found in class aaa.pear, please define the main method as: public static void main(String[] args).
我不明白为什么它错了,因为主类是启动类之外,内部的扩展应用。这直接来自一本书,我只需要知道为什么它不会运行。
谢谢,它的工作原理。错误的是我在另一堂课中有过。 – 2014-10-08 20:19:09
很高兴帮助。如果它解决了你的问题,请接受这个答案。 – MrHug 2014-10-08 20:21:11