Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Andy Reifman-Packett
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic