What is the purpose of writing custom exception classes when mostly what it does is same. For eg, NullPointerException:
class NullPointerException extends Ru
You need to have your client code know what exact exception happens by which part of code. so you need to let exception semantic and distinguished from other code block.
How to do this:
code
, message
or other info. the code
can tells what happens.To summarize it, Do something let your exception have some meaning/semantics, and let its client know what exactly happens.