简体   繁体   English

Java 非法启动类型?

[英]Java illegal start of type?

I have this:我有这个:

class undefinedException extends Exception {
     super("Its not defined!");
}

But I am getting: illegal start of type但我得到:类型的非法开始

Whats wrong?怎么了?

Thanks谢谢

It should be它应该是

class UndefinedException extends Exception {

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

}

You need to put the super call inside a constructor.您需要将super调用放在构造函数中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM