Exception Handling in Java
Exception Handling in Java
Exception Handling in Java
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Exception</strong> <strong>Handl<strong>in</strong>g</strong> <strong>in</strong> C++<br />
• Added to C++ <strong>in</strong> 1990<br />
• Design is based on that of Ada, and ML<br />
C++ <strong>Exception</strong> Handlers<br />
try {<br />
throw an actual parameter<br />
}<br />
catch (formal parameter) {<br />
-- handler code }<br />
catch (formal parameter) {<br />
-- handler code<br />
}<br />
• A throw expression accepts one parameter which is passed as an argument to the exception<br />
handler.<br />
• The type of this parameter is very important, s<strong>in</strong>ce the type of the argument passed by the<br />
throw expression is checked aga<strong>in</strong>st it, and only <strong>in</strong> the case they match, the exception is catch.<br />
22