class ExException
{
static String v="-" ;
public static void main(String[] args){
new ExException().v1();
System.out.println(v);
}
void v1(){
try{
v2();
}
catch(Exception e){
s+="C";
}
}
void v2() throws Exception{
v3(); v+="2";
v3(); v+="2b"
}
void v3() throws Exception{
throw new Exception();
}
}
Ans : -c
Once v3 throws the exception to v2,v2 throws it to v1() and no more of v2()'s code is executed.
{
static String v="-" ;
public static void main(String[] args){
new ExException().v1();
System.out.println(v);
}
void v1(){
try{
v2();
}
catch(Exception e){
s+="C";
}
}
void v2() throws Exception{
v3(); v+="2";
v3(); v+="2b"
}
void v3() throws Exception{
throw new Exception();
}
}
Ans : -c
Once v3 throws the exception to v2,v2 throws it to v1() and no more of v2()'s code is executed.
No comments:
Post a Comment