About 3,020,000 results
Open links in new tab
  1. java - How to put a Scanner input into an array... for example a …

    Jul 10, 2018 · For int array you can try: Scanner scan = new Scanner(System.in); int[] arr = Arrays.stream(scan.nextLine() .trim() .split(" ")) .filter(x -> !x.equals("")) …

  2. How to Take Array Input From User in Java? - GeeksforGeeks

    Apr 17, 2025 · The Scanner class from java.util helps to take user input. We can use the Scanner class with loops to take input for individual array elements (to use this technique, we must …

  3. how to take user input in Array using java? - Stack Overflow

    May 15, 2011 · Here's a simple code that reads strings from stdin, adds them into List<String>, and then uses toArray to convert it to String[] (if you really need to work with arrays). public …

  4. How to store input values in an array by using Scanner in Java

    Sep 19, 2013 · public class InputScanner { public static void main (String [] args) { int [] array = new int [3]; int [] array2 = new int [3]; Scanner scan = new Scanner (System.in); int i = 0; while …

  5. Storing Java Scanner Input in an Array - Baeldung

    Nov 29, 2023 · Learn how to store the input from a Scanner into an array with three different scenarios and examples.

  6. Java Store Scanner Input In Array: A Comprehensive Guide

    Learn how to store user inputs from the Scanner in an array using Java. Discover beginner to advanced techniques with practical examples.

  7. Java User Input (Scanner class) - W3Schools

    The Scanner class is used to get user input, and it is found in the java.util package. To use the Scanner class, create an object of the class and use any of the available methods found in the …

  8. How to put a Scanner input into an array... for example a

    To put input from a Scanner into an array in Java, you can use a loop to read the input and store it in the array. Here is an example of how you can do this: public class Main { public static void …

  9. Scanner in Array Java: How to Read User Input into an Array

    Learn how to use the Scanner class in Java to read data from an array. This tutorial provides step-by-step instructions with code examples, and it will help you rank 1 on Google for the …

  10. java - How to read in a value into an array using Scanner - Stack Overflow

    To start you will need to set up your scanner to read console input: Scanner scanner = new Scanner(System.in); You can then use function such as scanner.next() or scanner.nextInt() to …

Refresh