Sr.Java Web Developer Question:

Do you know how to create a custom Exception?

Tweet Share WhatsApp

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

Download Sr.Java Web Developer PDF Read All 64 Sr.Java Web Developer Questions
Previous QuestionNext Question
Tell us what is difference between Error and Exception?Please explain can we write multiple catch blocks under single try block?