Java Small Note Cs
Java Small Note Cs
• Checked Exceptions
• Unchecked Exceptions
8
Prepared by Renetha J.B.
Checked exception
• There are some exceptions that are defined by java.lang that
must be included in a method’s throws list, if a method
generates such exceptions and that method does not handle it
itself. These are called checked exceptions
• IOException
• FileNotFoundException
• SQLException
Prepared by Renetha J.B. 9
Checked exception(contd.)
try
finally catch
Java exception
handling is
managed via
FIVE
keywords:
throws throw
• i.e. catch is not “called” but controls goes out to catch when
exception occurs, so execution never “returns” to the try
block from a catch.
– the first one whose type matches that of the exception is executed.
• In this case, the try within the method is still nested inside the
outer try block, which calls that method.
• throw
• throws
• finally
throw ThrowableInstance;
}
catch(Exception e){System.out.println("Exception handled. "+e);}