注册 登录
编程论坛 JAVA论坛

编程思想里面的程序在我的电脑上面是错误的,请大神过来指点

新人学习 发布于 2018-10-30 21:33, 1842 次点击
public interface ClassInInterface
{
    void howdy();
    class Test implements ClassInInterface
    {
        public void howdy()
        {
            System.out.println("Howdy!");
        }
        public static void main(String[] args)
        {
            new Test().howdy();
        }
    }
}

/*
错误: 在类 ClassInInterface 中找不到 main 方法, 请将 main 方法定义为:
   public static void main(String[] args)
否则 JavaFX 应用程序类必须扩展javafx.application.Application
*/
2 回复
#2
林月儿2018-10-30 23:06
不知道要干嘛
#3
纵横阳仔2018-10-31 12:02
你这里定义的内部类中虽然写了main方法,在编译的时候只会把它当做一个普通的方法,所以会报上述的异常.该main方法可以在接口外调用
ClassInInterface.Test.main(null);
1