import java.io.ObjectOutputStream;
import java.io.ObjectOutputStream;
Look at line 38 and see what variable could be null. Then trace back thru your code to see why that variable does not have a valid value.
This is line 38 ( output.format( "%d %s %s %.2f\n",) in the class, but I am not understanding what is wrong with that line.
The blue lines are where I am seeing my errors.
There is only one variable on that line: output. So output must be null. Why is it null? That is what you have to find out. Hint: by default reference type variables are null if not initialised.
So pretty much I just need to initialize output? Is that what your saying?
It's upto you. Try it and see what happens.
I changed
Formatter output = null;
AccountRecord accounts[] = new AccountRecord[ 4 ];
To
Formatter output = new Formatter();
AccountRecord accounts[] = new AccountRecord[ 4 ];
Now it compiles, is that what you were telling me to do?
Once again it is upto you what you do. I can't tell you to do anything. But if the changes you made produce the correct results then why bother asking me.
Ok. Appreciate you guys helping me.
It compiled before with the null value, but it didn't execute without an error.Quote:
Now it compiles,
Does it execute ok now? Or at least not give you the NullPointerException.