• 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 while reading text files

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am currantly having a problem with text files...




// Method to calculate the sum of the marks entered by the user



... I canot to seem to find the problem. When I run the application it gives me the error i created "Error Occured While\nReading Text File".
can anyone help me please ???
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I have split this post from an old thread because it didn’t fit the previous subject.
You cannot tell what is happening because the cath block does not display the full details. You cannot tell what sort of Exception is happening, nor why. It is generally a bad idea to catch plain simple Exception. You should catch more specific Exceptions; for example the code you are using might throw IOException or FileNotFoundException. I would suggest replace the catch with the following code:Then you can see what sort of Exception is happening. When you have that knowledge, you can start working out what is happening. Please show us the stack traces.
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic