Why does my code give NullPointerException error?

The code does run either way, but the output is markedly different. Apparently I did not keep a copy and just deleted it after I solved the null pointer error, so it is possible it was initially inside the for loop when obviously it should be outside. I always assumed I could always go back to the original post and see my code, but obviously that is not the case. Good to know that some of us have more editorial tools than others, and some have the power to just wipe away an answer.

1 Like