So basically I have this in one of my files:
public class Player {
private String[] PlayerWeaps;
public Player(){
PlayerWeaps = new String[5];
}
public void addWeap(int index,String name){
PlayerWeaps[index] = name;
}
public String[] getPlWeaps(){
return this.PlayerWeaps;
}
And whenever I call it on my other file as
public class GM{
private Player player;
public GM(){
this.player = new Player();
}
public void run(){
for(int i=0;i<5;i++){
System.out.println("Weapons: " + player.getPlWeaps(i)); //this guy return's null
}
}
}
I also tried assigning player.getPlWeaps first but it doesn’t work too.
note: I’m self studying JAVA so I’m really not sure if theres something I have missed