I know Object class is the root class of all classes in Java, I wanted to know the relation between int[] and Object class.
Arrays.stream() can accept arg of int[], long[], double[] and Object[].
As I came across a code which gives int[] to a generic type (Stream<int[]>), This code works, we provide only class to Stream.
Also the output to this code was hex code rather than integers
int arr[] = { 1, 2, 3, 4, 5 };
// --------- Using Arrays.stream() ---------
// to convert int array into Stream
IntStream intStream = Arrays.stream(arr);
// Displaying elements in Stream
intStream.forEach(str -> System.out.print(str + " ")); // {1,2,3,4,5]
// --------- Using Stream.of() ---------
// to convert int array into Stream
Stream<int[]> stream = Stream.of(arr);
// Displaying elements in Stream
stream.forEach(str -> System.out.print(str + " ")); // I@asdf
System.out.println(arr.getClass())orObject obj = arr; int[] casted = (int[]) obj;