java - How to manage catches with the same behavior -
java - How to manage catches with the same behavior -
i have piece of code can throw 3 different types of exceptions. 2 of these exceptions handled in way while 3rd handled in way. there idiom not cutting , pasting in manner?
what is:
try { anobject.dangerousmethod(); } grab {aexception or bexception e) { /*do something*/ } grab {cexception e) { /*do else*/ }
there in jdk 7, not in before java versions. in jdk 7 code this:
try { anobject.dangerousmethod(); } grab {aexception | bexception e) { /*do something*/ } grab {cexception e) { /*do else*/ }
java exception
Comments
Post a Comment