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?
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?
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");
}