The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

oh,i know

Posted by yinbin on July 19, 2001 at 9:57 AM

> > You must be inheriting all your three exceptions classes from Exception class. So, in catch just pass an argument of type Exception and not of one of three types you have created and this will catch any of your three types of exceptions.

> > try {
> > }
> > catch ( Exception e ) {
> > // If you want to take action based on which type
> > // of exception ( out of 3) was caught then check the
> > // type of argument e here
> > }
> but the question means that you must catch three Exceptions once in a single catch block,but how?
yes,i know,i can use upcasting to upcast a class to its base-class,thank you!





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us