aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exception question 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 "Exception question" Watch "Exception question" New topic
Author

Exception question

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486


output :Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Unhandled exception type IOException

at testkg.ParentUltil.main(ParentUltil.java:34)

Can anyone please explain me this output.
I think we are catching the IOexception but then why its giving error


Thanks<br />Dinesh
Alexey Saenko
Ranch Hand

Joined: Aug 18, 2008
Posts: 30

Hi Dinesh,
please take a look at full signature of FileOutputStream.close(), here it is:

So, you should surround it with one more try/catch block


SCJP 6, SCBCD 5, OCEWSD 6
My blog: http://darkleden.wordpress.com
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
Dinesh, I usually wrap all file i/o in its own try/catch like this:



I just hacked it together, so I appologize for any errors.

EDIT: First time using code blocks, lol
[ November 19, 2008: Message edited by: Brian Legg ]

SCJA
~Currently preparing for SCJP6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception question