吃鸡游戏
一维基元数组在克隆时会复制元素。这诱使我们克隆二维数组(Array of Arrays)。请记住,由于的浅拷贝实现,二维数组克隆不起作用clone()。public static void main(String[] args) { int row1[] = {0,1,2,3}; int row2[] = row1.clone(); row2[0] = 10; System.out.println(row1[0] == row2[0]); // prints false int table1[][]={{0,1,2,3},{11,12,13,14}}; int table2[][] = table1.clone(); table2[0][0] = 100; System.out.println(table1[0][0] == table2[0][0]); //prints true}