What is the last item read before the NoSuchElementException?
What is in the file after the last thing that was read? The print outs of everything right after it was read will show you.
Which...
Type: Posts; User: Norm
What is the last item read before the NoSuchElementException?
What is in the file after the last thing that was read? The print outs of everything right after it was read will show you.
Which...
Why is that? How does the code find and read from the file?
That error says that there is no data to read.
To see where the program is reading in the file, add a println() statement that prints out everything that is read. If you look at the last thing...
At line 112 the code calls the next() method when there is no data to be read. Use the Scanner class's hasNext method to check that there is data BEFORE trying to read data that is not there.
If you are getting errors, you need to copy and post the full text of the error message.
There needs to be a section of the code that is executed after the code determines the type of the data that follows.
How many lines of data are for the data type found?
Is there a line that...
The code should use the results of the "set type of data" step to know how to process the following lines.
The else statement ignores those results.
Rework the logic so it uses the results of...
The else statements are executed when none of the above if statements are true.
Where does the code handle the lines for the type set by the next to last step? "set type of data"
What does the last step in the else do: deal correctly?
Where does the code handle the lines for the type set by the next to last step? "set type of data"
Try writing what you think should work and see what happens. When you have problems you can't figure out, post the code and your questions.
Can you explain what problem you are having detecting what type of data is next? Post a sample of the input file and explain the contents/format of what is on each line in the file.
else...