I would like to understand what array = array actually does.
Why does editing data1 leads to data2 being changed later on in the process?
String[][] data1 = new String[5][1];
String[][] data2 = new String[1][1];
data1[0][0] = "Test 1";
data2 = data1;
//Prints "Test 1"
System.out.println(data2[0][0]);
data1[0][0] = "NEW";
//Prints "NEW"
System.out.println(data2[0][0]);
data2 = data1;. Bothdata2anddata1refer to the same array (new String[5][1])data2wasn't a 2-dimensional array of strings thendata2 = data1will error out.data2 = data1actually make both variables point to the same array.