aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes finally Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "finally" Watch "finally" New topic
Author

finally

Val Lee
Ranch Hand

Joined: Nov 27, 2001
Posts: 41

Answer is E.I don't know why E is right.


Val SCJP2 1.2<br />====>SCJD
Basant K Sahu
Greenhorn

Joined: Jul 13, 2002
Posts: 3
I tried to compile the code and came out with two errors for line 13.
Error 1:Variable out may not have been initialized. The variable out is declared before the try block but is not initialised. It gets initialised only in the try block.
I modified the code to
to avoid this error.
Error 2: IOException must be caught or declared for out.close();
Error 2 looks self explanatory.
[ July 13, 2002: Message edited by: Basant K Sahu ]
zarina mohammad
Ranch Hand

Joined: Jun 26, 2002
Posts: 104
How to catch the Exception occuring in the finally block? Having a catch block after the finally block results in error.
how to get around with this error?
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
Originally posted by zarina mohammad:
How to catch the Exception occuring in the finally block? Having a catch block after the finally block results in error.
how to get around with this error?

You can nest a try/catch block inside the finally block.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Val Lee
Ranch Hand

Joined: Nov 27, 2001
Posts: 41
Thx.I understand!
Chung Huang
Ranch Hand

Joined: Jun 21, 2002
Posts: 56
Or, a lazy way would be throw the error up the chain.


Let us be showered in the light of confusion!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: finally