What variable is null?
testMarks or scanner2
Type: Posts; User: Norm
What variable is null?
testMarks or scanner2
Use the Scanner class's useDelimiter() method. There was one in the earlier posted code.
Here's a start on the design:
init file for scanning
begin loop to read lines from file
read a line from file and print it for debug
1). read in all the ints on the lines in the file and store...
The code needs to be redone. You need a new design and new code.
Start by designing what the method should do. Make a list of the steps(simple steps) that the code needs to do.
When you get a good design, then try coding it in small steps, with testing of each...
Please explain what the problems are.
The current code does not do what you want. It needs to be rewritten to do the things you want:
1). read in all the ints on the lines in the file and...
Do you have code for the new program? The old code doesn't do what you want.
The new program needs a second array to hold the Strings
Does this mean you are starting over with the program?
What are the steps the new program needs to take to
read in the first part of the lines and save the numbers in one array
and then read the...
Sorry, I don't know what the "other two" are. Can you post the current code with comments that shows the problem?
Use the scanner variable to call the useDelimiter() method:
scanner2.useDelimiter("[ ]*(,)[ ]*");
This was a problem I talked about in the other thread: The code chained together too many...
what does "still null" mean? If there are error messages, copy the full text and print them.
Change
testMarks[add][columns + num] = scanner.nextInt();
to
String aStr2 =...
String aStr = scanner.nextLine(); // read next line into a variable
System.out.println("aStr="+aStr); // show what was read
Scanner scanner2 = new Scanner(aStr); // set the Scanner to use...
That part of the code is not changed. The change is removing the calls to Scanner methods to a separate line,
printing what was read and then the value read is used where the calls to the Scanner...
Ok, now you need to change the code some so that ALL data that is read in is printed before it is used. These statements need to be changed:
Scanner scanner2 = new...
I guess asking for two things at the same time was confusing. Let me ask for them one at a time:
Post the full code with the debug println statements.
If you want help with your problem, this is what you have to do:
Post the code with the debug println statements.
Post the output from the program. Not an image.
Post the code with the debug println statements.
Post the output from the program.
Where did you post the version of the code with the println() statements for debugging?
Where did you post the output for when the code with the debug printlns was executed?
Post the code with the println statements that I've suggested be added for debugging.
Also post the output from when you have executed the code with those printlns.
You need to learn how to...
Have you tried debugging the code as suggested in post#20 in that thread?
You need to add the println statements so you can see what the computer sees when it executes the code.
If you get...
Please edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve formatting.
Please copy and paste here the full text of the error messages.