Hi guys, so I'm getting this error in my program. I'm getting a NullPointerException on this code:
I've got a class with the name Player, and I even tried calling two of the methods inside of it just to test, and they gave me the desired result. So I don't get it guys, why am I getting an error when I'm trying to add the Player variables p to the ArrayList players?
p = new Player(team, i);
Move to New To Java
We have no clue based upon what you posted. What is null on the line that throws the Exception? Add some println's to find out.
please post your full code...