Sr.Java Web Developer Question:
Download Questions PDF

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

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?