KohlerChris
Programmer
OK im a Begginer programmer working on my school assignment and my teacher knows nothing about java, my problem is when i create my class PlayerInfo like this
public class PlayerInfo{
Then in my main program i use it like this
PlayerInfo player = new PlayerInfo();
also later on in the program i use commands to input vales into it which works
eg player.InputPlayerXpos(4);
But later on in it i use my output method
eg x = player.OutputPlayerXpos();
and i get a null pointer exception
can somone tell me why my class is not keeping the variables in it? it it because it is not a thread and it just dies after everytime i use it? do i have to make it a thread? if so how do i keep the thread alive? what od i do ?
because i have already made my program around this PlayerInfo class
plz help pplz
public class PlayerInfo{
Then in my main program i use it like this
PlayerInfo player = new PlayerInfo();
also later on in the program i use commands to input vales into it which works
eg player.InputPlayerXpos(4);
But later on in it i use my output method
eg x = player.OutputPlayerXpos();
and i get a null pointer exception
can somone tell me why my class is not keeping the variables in it? it it because it is not a thread and it just dies after everytime i use it? do i have to make it a thread? if so how do i keep the thread alive? what od i do ?
because i have already made my program around this PlayerInfo class
plz help pplz