Answers for "Unchecked exception"

5

What are checked Exceptions

1) All the subclasses of Throwable class except error,Runtime Exception and 
its subclasses are checked exceptions.
2) Checked exception should be thrown with keyword throws or should be provided 
try catch block, else the program would not compile. We do get compilation 
error.
Examples :
1) IOException,
2) SQlException,
3) FileNotFoundException,
4) InvocationTargetException,
5) CloneNotSupportedException
6) ClassNotFoundException
7) InstantiationException
Posted by: Guest on December-01-2020
4

Unchecked exception

All subclasses of RuntimeException are called unchecked exceptions. 
These are unchecked exceptions because compiler does not checks if a method 
handles or throws exceptions. Program compiles even if we do not catch the 
exception or throws the exception. If an exception occurs in the program,
program terminates. It is difficult to handle these exceptions
because there may be many places causing exceptions.
Example : 
1) Arithmetic Exception
2) ArrayIndexOutOfBoundsException
3) ClassCastException
4) IndexOutOfBoundException
5) NullPointerException
6) NumberFormatException
7) StringIndexOutOfBounds
8) UnsupportedOperationException
Posted by: Guest on December-01-2020
6

try catch exception

First try block try to handle it
if not then catch block will handle it.
Finally block will executed regardless
of the outcome
Posted by: Guest on January-05-2021

Code answers related to "Unchecked exception"

Browse Popular Code Answers by Language