Sr.Java Web Developer Question:
Do you know how to create a custom Exception?
Answer:
To create you own exception extend the Exception class or any of its subclasses.
☛ class New1Exception extends Exception { } // this will create Checked Exception
☛ class NewException extends IOException { } // this will create Checked exception
☛ class NewException extends NullPonterExcpetion { } // this will create UnChecked exception
☛ class New1Exception extends Exception { } // this will create Checked Exception
☛ class NewException extends IOException { } // this will create Checked exception
☛ class NewException extends NullPonterExcpetion { } // this will create UnChecked exception
Previous Question | Next Question |
Tell us what is difference between Error and Exception? | Please explain can we write multiple catch blocks under single try block? |