Java非法启动类型?

Java非法启动类型?,java,Java,我有这个: class undefinedException extends Exception { super("Its not defined!"); } 但我得到了: 类型的非法开始 怎么了 谢谢您需要将super调用放入构造函数中。您需要将super调用放入构造函数中。它应该是 class UndefinedException extends Exception { public UndefinedException() { super("

我有这个:

class undefinedException extends Exception {
     super("Its not defined!");
}
但我得到了: 类型的非法开始

怎么了


谢谢

您需要将
super
调用放入构造函数中。

您需要将
super
调用放入构造函数中。

它应该是

class UndefinedException extends Exception {

       public UndefinedException() {
          super("Its not defined!");
       }

}
应该是

class UndefinedException extends Exception {

       public UndefinedException() {
          super("Its not defined!");
       }

}