try catch inside try catch

Hello everybody !!

if i have:

try{

//some code

try{

//more code

}catch(Exception e){

//dosomething

}

//more coding

}catch(Exception es){

}

if an Exception occurs inside the second try, why is it caught by the first try?

[763 byte] By [Mackleina] at [2007-11-27 6:50:58]
# 1

Not sure what you mean, this prints "inner" for me:

try{

try {

throw new Exception();

}

catch(Exception e) {

System.out.println("inner");

}

}

catch(Exception es) {

System.out.println("outer");

}

hunter9000a at 2007-7-12 18:25:10 > top of Java-index,Java Essentials,Java Programming...
# 2
> if an Exception occurs inside the second try, why is> it caught by the first try?Have you compiled and tested this? It's not caught by the first try.
BinaryDigita at 2007-7-12 18:25:11 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks a lot, it's as you say..... my bad, i had it wrong, sorry :(
Mackleina at 2007-7-12 18:25:11 > top of Java-index,Java Essentials,Java Programming...
# 4
> my bad, i had it wrong, sorry :(The floggings are forthcoming.
BinaryDigita at 2007-7-12 18:25:11 > top of Java-index,Java Essentials,Java Programming...