Checked Exceptions
Checked exceptions are the objects of the
Exception class or any of its subclasses excluding the Runtime Exception
class. Checked Exceptions are the invalid conditions that occur in a java
program due to invalid user input, network connectivity problem or database
problems.
Java uses the try-catch block to handle
the checked exceptions. The statements within a program that throw an exception
are placed in the try block. You associate an exception-handler with the try
block by providing one or more catch handlers immediately after the try
block.Various checked exceptions defined in the java.lang.package are,
1.
ClassNotFoundException
2.
IllegalAccessException
3.
InstantiationException
4.
NoSuchMethodException
5.
IOException
Unchecked Exceptions
Unchecked exceptions are the run-time
errors that occur because of programming errors, such as invalid arguments
passed to a public method. The java complier does not check the unchecked
exceptions during program compilation.Various Unchecked Exceptions are,
1.
ArithmeticException
2.
ArrayIndexOutOfBoundsException
3.
ArrayStoreException
4.
ClassCastException
5.
IllegalArgumentException
6.
NegativeArraySizeException
7.
NullPointerException
8.
NumberFormatException
No comments:
Post a Comment