Sr.Java Web Developer Question:

Download Job Interview Questions and Answers PDF

Do you know how to create a custom Exception?

Sr.Java Web Developer Interview Question
Sr.Java Web Developer Interview Question

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 Interview Questions And Answers PDF

Previous QuestionNext Question
Tell us what is difference between Error and Exception?Please explain can we write multiple catch blocks under single try block?