Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error that wont go away

 
Sally Curtis
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i dont know why but i keep get the following error:
unreported exception java.io.IOException; must be caught or declared to be thrown
problem=askString("type in the first problem.",1);
anyone know why this might be happening?
 
Billybob Marshall
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without any more detail given, it would appear that the mystical method "askString" might throw an IOException, so you have to put a try/catch block around it and deal with the exception yourself, or let the exception pass up to the caller. So either:
try {
askString(...);
}
catch(IOException e) {
// deal with it here
}
or:
yourMethod(arguments) throws IOException {
// your current method here, without catching the exception
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic