Was just getting my hands dirty with Java 8 and stumbled on a behaviour as below -
public static void main(String... args){
System.out.println("[Start]");
int[] ints = {1, 2, 3, 4};
Stream.of(ints).forEach(i->System.out.println("Int : "+i));
Integer[] integerNums = {1, 2, 3, 4};
Stream.of(integerNums).forEach(i->System.out.println("Integer : "+i));
System.out.println("[End]");
}
And the output is :
[Start]
Int : [I@5acf9800
Integer : 1
Integer : 2
Integer : 3
Integer : 4
[End]
Whereas I was expecting the code to print all int's and Integer's in both the cases? Any insights on this would be greatly helpful...