Answer the question
In order to leave comments, you need to log in
Doesn't save data to an object?
In general, there is a BodySky object that stores the type of the body.
However, when I try to change its value through the changeData method , it simply does not change
public static final int MAX_BODYS = 2;
public class BodySky {
int[] type = new int[MAX_BODYS];
}
public void changeData(int newtype) {
BodySky bodysky = new BodySky();
for (int i = 0; i < MAX_BODYS; i++) {
System.out.println(bodysky.type[i]);
if(bodysky.type[i] == 0)
{
bodysky.type[i] = newtype;
break;
}
}
}
public Main() {
changeData(2);
changeData(4);
}
public static void main(String[] args) {
new Main();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question