how to get multiple integer input in java code example
Example 1: how to get multiple integer input in java
String input = scanner.nextLine(); // get the entire line after the prompt
String[] numbers = input.split(" "); // split by spaces
Example 2: how to get multiple integer input in java
Scanner scanner = new Scanner(System.in);
while(scanner.hasNext())
{
System.out.println(scanner.nextInt());
}