Re: Calling all Java Gurus (As well as beginners like me)
I actually took the Java Programming class in my MIS about 2 years ago but since I never used it again its all gone. I have actually started to go through my class material again. Here is how to catch exceptions in subclass.
/**
*
* Author: Joel Khan
* Date Created: 1-29-2012
* Purpose: Week 4 iLab IS579: Java Program to catch subclass exceptions.
*
*
*/
public class Demo
{
public static void main( String] args )
{
try // throw ExceptionC
{
throw new ExceptionC();
} // end try
catch ( ExceptionA exception1 ) // catch ExceptionA and subclasses
{
System.err.println( "First Exception subclass caught.
" );
} // end catch
try // throw ExceptionB
{
throw new ExceptionB();
} // end try
catch ( ExceptionA exception2 ) // catch ExceptionA and subclasses
{
System.err.println( "Second Exception subclass caught.
" );
} // end try
} // end main
} // end class Demo