





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















Fall 2009 Instructor: Dr. Masoud Yaghini
Exception Handling
Exception Handling
Exception Handling
nullnull^ reference is used where an object isnullnull
-^ when a
nullnull^ reference is used where an object isnullnull expected
ScannerScannerScannerScanner
method^
nextIntnextIntnextIntnextInt
receives a
Exception Handling
Exception Handling
Exception Handling
(DivideByZeroNoExceptionHandling.java:
23 )
at^ DivideByZeroNoExceptionHandling.main
(DivideByZeroNoExceptionHandling.java:
23 )
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Exception Handling
Exception Handling
Exception Handling
Exception Handling
catchcatchcatchcatch
-^ Exception parameter in parentheses – exception^ parameter identifies the exception type and enablesparameter identifies the exception type and enables^ catchcatchcatchcatch
block to interact with caught exception object
-^ Block of code in curly braces that executes whenexception of proper type occurs
Exception Handling
-^ the type of the exception parameter matches thethrown exception type exactly Uncaught exception –^ an exception that occurs for which there are no^ matching
catchcatchcatchcatch^ blocks matching
catchcatchcatchcatch^ blocks