I'm learning Stream and I tried to print an int Array using asList Method found in the class Arrays , unfortunatly i'm getting a wrong result.
could someone explain to me why i'm getting this wrong result.
public class array {
public static void main(String[] args) {
/*my way*/
int [] array = new int[]{1,2,3,7,1};
Arrays.asList(array).stream().forEach(System.out::println);
System.out.println();
/*the good way*/
Arrays.stream(array).forEach(System.out::print);
}
}
result :
[I@3e3abc88
12371