Originally Posted by
KristopherP
I am trying to copy the contents of a file into an array.
I'm confused over the instructions. An array, as in singular?
Originally Posted by
KristopherP
The contents of the file is
John X Doe 4.0 6 8.2 9
One single line? Or are there more lines? Will each line contain the same exact setup, which appears to be:
firstName middleInitial lastName double int double int
Originally Posted by
KristopherP
The code the instructor wrote on the board.
The instructor give you the code you are supposed to write? Again I do not understand what you mean here.
Originally Posted by
KristopherP
Exception in thread "main" java.lang.NumberFormatException: For input string: "Doe"
at sun.misc.FloatingDecimal.readJavaFormatString(Floa tingDecimal.java:1224)
at java.lang.Double.parseDouble(Double.java:510)
at fileToArray.getInput(fileToArray.java:37)
at fileToArray.main(fileToArray.java:16)
I am not sure what happened. Can anyone assist? Thanks
The exception means that "Doe" is not a number.
Add some printlns to see the value of the variables like line, st, m... this will show the symptoms in more detail and help discover the cause
--- Update ---
Please do not double post your questions
Threads merged