Create the following new exceptions: PokemonException, which extends the Exception class. It must have a no-parameter constructor, which just calls the corresponding superclass constructor KantoPokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor JohtoPokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor Hoenn PokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor SinnohPokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor Unova PokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor Kalos PokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor AlolaPokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor GalarPokemonException, which extends PokemonException. It must have a no-parameter constructor, which just calls the no-parameter superclass constructor

Respuesta :

Answer:

public class PokemonException extends Exception {

public PokemonException() {

super();

}

}

public class KantoPokemonException extends PokemonException {

public KantoPokemonException() {

super();

}

}

public class JohtoPokemonException extends PokemonException {

public JohtoPokemonException() {

super();

}

}

public class HoennPokemonException extends PokemonException {

public HoennPokemonException() {

super();

}

}

public class SinnohPokemonException extends PokemonException {

public SinnohPokemonException() {

super();

}

}

public class UnovaPokemonException extends PokemonException {

public UnovaPokemonException() {

super();

}

}

public class KalosPokemonException extends PokemonException {

public KalosPokemonException() {

super();

}

}

public class AlolaPokemonException extends PokemonException {

public AlolaPokemonException() {

super();

}

}

public class GalarPokemonException extends PokemonException {

public GalarPokemonException() {

super();

}

}

Explanation:

  • A separate Java file needs to be created for each of the following exception.
  • Inside the constructor, call the super() method to inherit all the properties of a parent class.