aspose file tools*
The moose likes Beginning Java and the fly likes no such element help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "no such element help" Watch "no such element help" New topic
Author

no such element help

Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 74
I'm having trouble figuring out what I'm doing wrong that I'm getting the error no line found. Here is my code. I'm having the problem on line 120 and 19
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
well, at a quick guess, there are no more lines in the file you're reading...
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Before reading next line of the Scanner, check whether they exist using hasNextLine() method. So all your below nextLine() should have a hasNextLine() check and the nextInt() should have hasNextInt() check.

Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
Thank you that helped!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: no such element help