This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes can't understand the output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "can Watch "can New topic
Author

can't understand the output

vaibhav srivastava
Greenhorn

Joined: Feb 24, 2008
Posts: 14
public class main{
public static void main(String[] args){
try {
new Exception();
}catch(Exception e) {
try {
System.out.println("1");
new Exception();
}
catch(Exception f) {
System.out.println("2");
}
finally {
System.out.println("finally 1");
}
}
finally {
System.out.println("finally 2");
}
}
}


output
finally 2


A computer once beat me at chess, but it was no match for me at kick boxing.<br />
Laxmikant Ruikar
Greenhorn

Joined: Nov 29, 2005
Posts: 23
You are creating Excpetion object. You code is not throwing any excpection. So after try block, finally block is executing...

LDR
vaibhav srivastava
Greenhorn

Joined: Feb 24, 2008
Posts: 14
thanks laxmi...
I just missed the obvious !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't understand the output