Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Read from a file with three lines but the length is 116  RSS feed

 
Isaac Ferguson
Ranch Hand
Posts: 1063
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi my code is



This is very urgent for me

Any idea, please?

Thanks
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So is it the file length that is 116 or is the number of lines you load 116 or the number of fields is 116? That code will read all the lines in the file - even blank lines so if you are getting more than 3 lines then the chances are you have a load of blank lines after your 3 primary lines.

P.S. You don't actually close the file. Why not ?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!