Java 错误提示:找不到主方法



 public class CheckHandSetNum {
    public static void main(String[] args) {
        String telephone1="11024588795";
        String telephone2="15044268138";
        System.out.println(check(telephone1));
        System.out.println(check(telephone2));
    }
    public static String check(String handset) {
        String regex="1[3,5,8]\\d{9}$";
        if(handset.matches(regex)) {
            return handset+"\n是合法的手机号码";
        }
        else {
            return handset+"\n不是合法的手机号码";
        }
    }
}

错误: 在类 Program6.CheckHandSetNum 中找不到 main 方法, 请将 main 方法定义为:
public static void main(String[] args)
否则 JavaFX 应用程序类必须扩展javafx.application.Application

java

来栖川千歌音 9 years, 6 months ago

检查下 classpath

renhono answered 9 years, 6 months ago

Your Answer