There are several ways to print an array elements.First of all, I'll explain that, what is an array?..Array is a simple data structure for storing data..When you define an array , Allocate set of ancillary memory blocks in RAM.Those memory blocks are taken one unit ..
Ok, I'll create an array like this,
class demo{
public static void main(String a[]){
int[] number={1,2,3,4,5};
System.out.print(number);
}
}
Now look at the output,

You can see an unknown string printed..As I mentioned before, the memory address whose array(number array) declared is printed.If you want to display elements in the array, you can use "for loop " , like this..
class demo{
public static void main(String a[]){
int[] number={1,2,3,4,5};
int i;
for(i=0;i<number.length;i++){
System.out.print(number[i]+" ");
}
}
}
Now look at the output,

Ok,Successfully printed elements of one dimension array..Now I am going to consider two dimension array..I'll declare two dimension array as "number2" and print the elements using "Arrays.deepToString()" keyword.Before using that You will have to import 'java.util.Arrays' library.
import java.util.Arrays;
class demo{
public static void main(String a[]){
int[][] number2={{1,2},{3,4},{5,6}};`
System.out.print(Arrays.deepToString(number2));
}
}
consider the output,

At the same time , Using two for loops ,2D elements can be printed..Thank you !
hashCode()
in hexadecimal. SeeObject#toString()
. – 4castle Nov 10 '16 at 21:22