File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes unreported exception java.io.IOexception; must be caught or declared to be thrown Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "unreported exception java.io.IOexception; must be caught or declared to be thrown" Watch "unreported exception java.io.IOexception; must be caught or declared to be thrown" New topic
Author

unreported exception java.io.IOexception; must be caught or declared to be thrown

Andy Reifman-Packett
Greenhorn

Joined: Feb 14, 2012
Posts: 1
I'm trying to compile this and every time that I do I get the error message "unreported exception java.io.IOexception; must be caught or declared to be thrown" with the line Highscore p1 = new Highscore(named, Accuracy, aTime); highlighted



I realize this is a lot of code and I'm sorry but does anyone have any idea as to why this might be happening?
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

The error message is telling you exactly what's wrong. Since the code you're executing can throw that exception, you either have to catch it and handle it, or you have to declare that your method throws it, so your caller knows to expect it.

Google for java exceptions tutorial for an intro to exception handling.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unreported exception java.io.IOexception; must be caught or declared to be thrown
 
Similar Threads
Shapes with slider
Family Tree Help
can't print Image , Black rectangle is printed ???
hide object
Applet refuses to repaint