Your loop will print each of the sub-arrays, by printing their address. Given that inner array, use an inner loop:
for(int[] arr2: array1)
{
for(int val: arr2)
System.out.print(val);
}
Arrays don't have a String
representation that would, e.g. print all the elements. You need to print them explicitly:
int oneD[] = new int[5];
oneD[0] = 7;
// ...
System.out.println(oneD);
The output is an address:
[I@148cc8c
However, the libs do supply the method deepToString for this purpose, so this may also suit your purposes:
System.out.println(Arrays.deepToString(array1));