The quieter you are, the more you are able to hear.
Kemal Sokolovic wrote:Why are you catching new line character again at line 20, when you previously invoked nextLine()?
The quieter you are, the more you are able to hear.
Kemal Sokolovic wrote:And what is the format of the data you are trying to read from the file? I just tested code (without line 20) for the given content of txt file:
and everything works file.
The quieter you are, the more you are able to hear.
The quieter you are, the more you are able to hear.
The quieter you are, the more you are able to hear.
Campbell Ritchie wrote:Glad to be able to help.
But where is your Account class? You ought to read all those data from the file, create an Account object, and use its toString() method to display it. In the toString() method you can get everything formatted nicely; I would probably use String#format and the % tags, remembering to use %n for new line.
Don’t use println(" ") unless you specifically want spaces before the next text. If you simply want a new line, use println();
The quieter you are, the more you are able to hear.
Kemal Sokolovic wrote:You have learned file I/O, but you haven't learned about classes, toString() and other things Mr Campbell mentioned?
The quieter you are, the more you are able to hear.
Kemal Sokolovic wrote:All right then. It's a little different learning path than the one I followed couple of years ago.
Both.Raymond Gillespie wrote: . . . Is Mr. Campbell talking about creating a class or object? . . .
Campbell Ritchie wrote:
Both.Raymond Gillespie wrote: . . . Is Mr. Campbell talking about creating a class or object? . . .
The quieter you are, the more you are able to hear.
Kemal Sokolovic wrote:Then do it yourself, on the side, and for the class do whatever the requirement is. Don't wait for others to teach you how to write programs.
The quieter you are, the more you are able to hear.
Kemal Sokolovic wrote:I thought you've already resolved that issue with reading a file? What, it's still not reading the last one?
The quieter you are, the more you are able to hear.