WithoutBook Forum
Ques. try catch finally printstacktrace in Eclipse
- Suppose system.out.println is writted in try, catch and finally all blocks. And e.printStackTrace is writted in catch block.
try{
System.out.println(\"Try\");
int i=1/0;
}
catch(Exception e){
System.out.println(\"Catch\");
e.printStackTrace();
}
finally{
System.out.println(\"Finally\");
}
For this program I\'ve seen printStackTrace error comes anywhere. It maybe just after Try, May be just after Catch or may be just after Finally; which should be only after Catch.
Why this is happening please let me know.
Posted on Jul 18, 2014 by Pom Berry