Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  LAb 4
Language: C/C++
Code:
ic class TestException {

        public static void main(String[] args){

            try{
                getExceptionB();
            }catch(ExceptionA ea){
                ea.printStackTrace();
            }

            try{
                getExceptionC();
            }catch(ExceptionA ea){
                ea.printStackTrace();
            }

        }

        public static void  getExceptionB() throws ExceptionB{
            throw new ExceptionB("Exception B");
        }

        public static void  getExceptionC() throws ExceptionC{
            throw new ExceptionC("Exception C");
        }

    }
public class ExceptionA extends Exception {

        public ExceptionA(String Meow){
            super(Meow);
        }
    }
public class ExceptionB extends ExceptionA {

        public ExceptionB(String Meow){
            super(Meow);
        }
    }
public class ExceptionC extends ExceptionB {

        public ExceptionC(String Meow){
            super(Meow);
        }
    }
Comments: