View RSS Feed

Advanced Java

Checked and Unchecked Exceptions

Rate this Entry
by , 02-18-2012 at 04:14 PM (784 Views)
Checked exceptions: Programmers are facilitated by checked Exceptions so that to dealings with exceptions which could be thrown. Exception class has sub classes. Checked Exception examples are:

Arithmatic exception

In a method when checked exception takes place, either program caught it or it passes to caller program.

Unchecked exceptions: They are RuntimeException. Class Errors and subclasses of it are also unchecked.

Example: ArrayIndexOutOfBounds Exception.

Exception Statement Syntax

Use try-catch-finally construct to handle Exceptions, which consist of the Syntax
Java Code: This is the code to explain exception handling in java
try {
<code>
} catch (<exception type1> <parameter1>) { // 0 or more
<statements>
}
} finally { // finally block
<statements>
}

Submit "Checked and Unchecked Exceptions" to Facebook Submit "Checked and Unchecked Exceptions" to Digg Submit "Checked and Unchecked Exceptions" to del.icio.us Submit "Checked and Unchecked Exceptions" to StumbleUpon Submit "Checked and Unchecked Exceptions" to Google

Comments