How can we create our own exception ? Explain with example.
Answers
Answered by
0
Java provides us facility to create our own exceptions which are basically derived classes of Exception. For example MyException in below code extends the Exception class. We pass the string to the constructor of the super class- Exception which is obtained using “getMessage()” function on the object created.
Answered by
5
if you are creating your own exception that is known as custom exception or user defined exception.
by the help of custom exception you have your own exception or messages..
follow me
Similar questions