We use exception subclasses such as
FileNotFoundException
so that we display the correct message.
If we used only the exception when the application throws an exception, we would not know what the exception is.
This is not very suitable for debugging. Using child classes also helps us better log exceptions.
source
share