Exception propogation

class E1 {
	void disp() {
		System.out.println("1st statement in E1");
		int i = 100 / 0;
		System.out.println("2nd second in E1");
	}
}
class E2 extends E1 {
	void disp() {
		System.out.println("1st statement in E2");
		super.disp();
		System.out.println("2nd second in E2");
	}
}
class E3 extends E2 {
	void disp() {
		System.out.println("1st statement in E3");
		super.disp();
		System.out.println("2nd second in E3");
	}
}
class E4 extends E3 {
	void disp() {
		System.out.println("1st statement in E4");
		try {
			super.disp();
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("2nd	 second in E4");
	}
}
public class ExceptionPropogation {
	public static void main(String[] args) {
		E4 e4 = new E4();
		e4.disp();
	}
}

Download

Exception Example in Java

Exception Example
Exception Propogation
User Defined Exception


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code