try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { Object[] test = Arrays.stream(br.readLine().split(" ")).map(string -> Integer.parseInt(string)).toArray(); System.out.println(Arrays.toString(test)); } catch (IOException E) { }
So this code works, but it returns an array of type Object[] However, I want it to return an array of type int[] .
Does anyone have any idea how I can do this?
source share