I'm really new to coding and right now I need to take an input from the user in one line seperated by spaces for example "0 1 2" and then take the ints in that string and place them in separate int variables.
This is what I have so far:
Scanner scan = new Scanner(System.in); //takes input from user
input = scan.nextLine();
Scanner intValues = new Scanner(input); //takes input from the "input" variable
then I go to place the first int value into a variable and get a "NoSuchElementException"
int x = intValues.nextInt();
What am I doing wrong here? Also I'm not allowed to use arrays for this assignment.