class ArrayShallow { public static void main(String args[]) { int intArray1[][] = { { 1, 2, 3 }, { 4, 5 } }; int cloneArray1[][] = intArray1.clone(); // will print false System.out.println(intArray1 == cloneArray1); // will print true as shallow copy is created // i.e. sub-arrays are shared System.out.println(intArray1[0] == cloneArray1[0]); System.out.println(intArray1[1] == cloneArray1[1]); } } /* When you clone a single-dimensional array, such as Object[], a shallow copy is performed. The original and cloned arrays have the same contents but are different objects in memory (intArray == cloneArray returns false). */