why name of array "list" first printed as reference and second code printed content of it.
int[] list = new int[5];
list[0] = 1;
list[1] = 2;
System.out.println(list);
It prints the reference [I@4dd8dc3
and i know that i should use for loop to iterate over elements.
But why there is in other code gives me the content not the address? Is that specific for generics?
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
System.out.println(list);
that prints [1, 2]