Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

Exception Handing

 
Ma JianHui
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
public class Plane {
static String s = "-";

public static void main(String[] args) {
new Plane().s1();
System.out.println(s);
}

void s1() {
try{
s2();
}catch(Exception e) {
s +="c";
}
}

void s2()throws Exception {
s3(); s +="2";
s3(); s +="2b";
}

void s3() throws Exception {
throw new Exception();
}

}


The output is : "-c",what is going on?
Please help me!Thanks!
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please avoid posting the same query more than once as it wastes time.
 
    Bookmark Topic Watch Topic
  • New Topic