The task is to create an own exception class which has a constructor. It has one parameter, which is an integer. If it's zero we must call the super with the string of "This", if it's not zero we must call the super of "That". I can't figure out, how can I solve this because if I use If-Else conditional operator, than IDEA says "Call to 'super()' must be first statement in constructor body.". The code is:
public class MyException extends RuntimeException {
public MyException(int number) {
if(number == 0) {
super("This");
} else {
super("That");
}
}
}