• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error that wont go away

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic