我收到错误:
错误:在类testPackage.Method1中找不到主方法,请将main方法定义为:public static void main(String [] args)或JavaFX应用程序类必须扩展javafx.application.Application“
该计划是:
package testPackage;
public class Methods {
public static void main(String[] args) {
myFirstMethod();
}
public static void myFirstMethod() {
System.out.println("Hello World");
}
}
1 回答
您的类的名称是Methods,但您似乎正在调用Method1 . 使用正确的类名称调用它 . 换一种说法:
java testPackage.Methods