Re: Exception handling
- From: Malte <You_can_spam_me_here@xxxxxxxxx>
- Date: Sun, 30 Oct 2005 12:12:22 +0100
Sharp Tool wrote:
Hi,
I want to check if a statement throws an exception. If it does, I want to deal with it then and there, and not at the catch claus. See code below:
... String[] str = {"dinner"}; if (str[1].charAt(0) throws ArrayIndexOutOfBoundsException) // compile error { //do something 1 } else //do something 2
Is this possible?
Sharp Tool
Why not:
try {
// whatever
// do something 2
} catch (ArrayIndexOutOfBoundsException e) {
// deal with it, ie do something 1
}
.- Follow-Ups:
- Re: Exception handling
- From: Sharp Tool
- Re: Exception handling
- References:
- Exception handling
- From: Sharp Tool
- Exception handling
- Prev by Date: only one instance
- Next by Date: Re: Exception handling
- Previous by thread: Re: Exception handling
- Next by thread: Re: Exception handling
- Index(es):
Relevant Pages
|