I have to create this little method inside a class that adds a planet to a galaxy, but it seems that the element k+1 in array planeta is not replaced... is it because it's inside the if statement?
public void addPlanet(String planetName, BigInt x, BigInt y, BigInt z) {
if (planetExists(planetName) && !complete()){
newSP= new SpacePoint(x,y,z);
newPlanet= new Planet("planetName",newSP);
int k=this.size();
planeta[k+1]=planetName; //doesnt replace because its inside the if??
}
}
I'm sorry if it's an easy question, I'm taking java classes in college and I'm really new... PS: btw thank you all, you've been my teachers for these days!! =)
planetExistsandcompletedo?