January 2018
Intermediate to advanced
434 pages
14h 1m
English
Let's take a look at the implementation of the Exception class:
public class Exception extends Throwable { static final long serialVersionUID = -3387516993124229948L;public Exception() { }public Exception(String var1) { super(var1); }.....
As you can see, we have a second constructor that takes a String as a parameter. In our CustomException class, we have supplied it by passing its message to the superclass's constructor. Also, you can create a custom exception with an empty constructor because Exception also has an empty constructor.
Read now
Unlock full access