Download presentation
Presentation is loading. Please wait.
Published byKellen Arling Modified over 9 years ago
1
Exception Handling – illustrated by Java mMIC-SFT November 2003 Anders P. Ravn Aalborg University
2
An exception handler try { /* block of code – domain of the handler */ c_obj.m();... } catch (MyException ex){ /* block of code – handler for ex of class MyException */... } catch (...) {... block of code }... } finally {... block of code }
3
Throwing an Exception try {... block of code c_obj.m(); } catch (MyException ex){... } class C { void m() {... throw new MyException(”bad”,10); } c_obj = new C();
4
Declaring an Exception public class MyException extends Exception... public MyException(string s, int n){... }
5
Recovery blocks ENSURE acceptance_test BY { module_1 } ELSE BY { module_2 }... ELSE BY { module_m } ELSE ERROR BW p. 120
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.