Exception handling



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







.



Relevant Pages

  • Re: Exception handling
    ... >> Sharp Tool ... Like i said I don't want to deal with the exception in the catch claus. ... Prev by Date: ...
    (comp.lang.java.programmer)
  • Newbie: Catching the Abort method to destroy a thread
    ... This is beyond my skill-set. ... and my ASP.NET app seems to be ... is this a "critical" exception? ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)
  • .NET System.DirectoryServices question
    ... If the domain name is incorrect, the DirectoryEntry.Exists call takes a LONG ... time to return and throws an exception with the message "The server is not ... Prev by Date: ...
    (microsoft.public.win2000.active_directory)
  • .NET System.DirectoryServices question
    ... If the domain name is incorrect, the DirectoryEntry.Exists call takes a LONG ... time to return and throws an exception with the message "The server is not ... Prev by Date: ...
    (microsoft.public.dotnet.framework)
  • Re: new line
    ... > How to write this code but with exception to put a function.Name into a ... > I want to get a string name into a list like this: ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)