e.p e.p - 1 year ago 110
Java Question

Creating my own class exception

I cant understand what it does this code.Also, i have a main that i throw this exception .Could you explain me what it does RuntimeException,super s and etc?

public class InvalidException extends RuntimeException{

public InvalidException (String s){

Answer Source

Concerning what RuntimeException does, you may refer to the official JavaDocs https://docs.oracle.com/javase/7/docs/api/java/lang/RuntimeException.html

super (when used in a constructor) calls the constructor of the class from which you inherited (here: RuntimeException). For more details refer to https://docs.oracle.com/javase/tutorial/java/IandI/super.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download