I have a problem in Eclipse. Why is the value of oldList
different in LogCat while I don't change it between the tow Log command?
First I have an initialize
method:
private void initialize() {
list[0][0] = 2;
list[0][1] = 4;
list[1][0] = 3;
list[1][1] = 7;
oldList = list;
going();
}
and in the going
method, I printed oldList
twice :
private void going() {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
Log.i("Log", "oldList = " + oldList[i][j]);
}
}
Log.i("Log", "---------------------------");
// ----------------------------------------------------
list[0][0] = 0;
list[0][1] = 5;
list[1][0] = 0;
list[1][1] = 0;
// ----------------------------------------------------
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
Log.i("Log", "oldList = " + oldList[i][j]);
}
}
}
but the two results is different in LogCat :
oldList = 2
oldList = 4
oldList = 3
oldList = 7
---------------------------
oldList = 0
oldList = 5
oldList = 0
oldList = 0
While i don't change it between the two logs. I just change the value of list
, not oldList
. Why does the output change?