Re: Exception handling
- From: "Sharp Tool" <sharp.tool@xxxxxxxxxxxxxx>
- Date: Sun, 30 Oct 2005 11:30:09 GMT
> 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
> }
Like i said I don't want to deal with the exception in the catch claus.
Doing so, will not return me to where I left off.
Sharp Tool
.
- Follow-Ups:
- Re: Exception handling
- From: Thomas Hawtin
- Re: Exception handling
- References:
- Exception handling
- From: Sharp Tool
- Re: Exception handling
- From: Malte
- Exception handling
- Prev by Date: Re: Exception handling
- Next by Date: Re: only one instance
- Previous by thread: Re: Exception handling
- Next by thread: Re: Exception handling
- Index(es):
Relevant Pages
|