To create you own exception extend the Exception class or any of its subclasses.e.g. 1 class New1Exception extends Exception { } // this will create Checked Exception 2 class NewException extends IOExcpetion { } // this will create Checked exception 3 class NewException extends NullPonterExcpetion { } // this will create UnChecked exception
Java
Topic: Exceptions
How to create custom Exception?
Browse random answers:
What is an Exception?
What is a Java Exception?
What are the different ways to generate an Exception?
Where does Exception stand in the Java tree hierarchy?
Is it compulsory to use the finally block?
How are try, catch and finally block organized?
What is a throw in an Exception block?
What is the use of throws keyword?
What are Checked Exceptions and Unchecked Exceptions?
What are Chained Exceptions?
Exceptions are defined in which java package?
What is Runtime Exception or unchecked exception?
What is difference between ClassNotFoundException and NoClassDefFoundError?
How to create custom Exception?
Why did the designers decide to force a method to specify all uncaught checked exceptions that can be thrown within its scope?
Can you give an example of an unrecoverable problem when error is thrown?
Explain the difference between the two approaches of exception handling