i've two class. the first class is
public class A{
private static int[] x = {0,0,0,0};
private static int justX = 0;
public A(){}
public static int[] getX(){return x;}
public static int getJustX(){ return justX;}
}
and the second class is
public class B extends . . .{
private int[] x;
private justX;
public B(){
x = A.getX();
justX = A.getJustX();
Log.d("X: ", Arrays.toString(x)); //X: {0,0,0,0}
Log.d("JUST X: ", String.value(justX)); //JUST X: 0;
}
private void onTouch(){
x[0] = 1;
x[1] = 1;
x[2] = 1;
x[3] = 1;
justX = 1;
Log.d("X: ",Arrays.toString(A.getX())); //X: {1,1,1,1}
Log.d("JUST X: ", String.value(A.getJustX())); //JUST X: 0;
}
}
array variable from class A changed but integer variable has not changed, Why did it happen?