PPT Slide
J.53
Catching Exceptions
Syntax:
try <block>
catch (<exception_type> <identifier>)
<block>
catch(<exception_type> <identifier>)
<block>
. . .
finally <block>
Example:
try{
attributedObj.replaceValue(“Age”, new Integer(8));
}
catch(NoSuchAttributeException e) {
Attr attr = new Attr(e.attrName, e.newValue);
attributedObj.add(attr);
}
Previous slide
Next slide
Back to first slide
View graphic version