Skip to content

Commit b5e1bc1

Browse files
Update exception_prpogation.java
1 parent 0e136d6 commit b5e1bc1

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

exception_prpogation.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1-
public class exception_prpogation {
2-
void fun1(){
1+
public class exception_prpogation
2+
{
3+
void fun1()
4+
{
35
int data=50/0; //exception occurs
46
}
57
//exception prpogated to fun2()
6-
void fun2(){
8+
void fun2()
9+
{
710
fun1(); //exception not handled
811
//exception propogated to fun3()
912
}
10-
void fun3(){
11-
try{
13+
void fun3()
14+
{
15+
try
16+
{
1217
fun2();//exception handled
1318
}
14-
catch(Exception e){System.out.println("Exception handled");
15-
}}
16-
public static void main(String args[]){
19+
catch(Exception e)
20+
{
21+
System.out.println("Exception handled");
22+
}
23+
}
24+
public static void main(String args[])
25+
{
1726
exception_prpogation obj =new exception_prpogation();
1827
obj.fun3();
1928
System.out.println("rest of the code");
20-
}
21-
29+
}
2230
}

0 commit comments

Comments
 (0)