I'm just curious:
Assume I set up a scanner as such.
Scanner sc = new Scanner (System.in)
int number = sc.nextInt();
String name = sc.nextLine();
System.out.println (number);
System.out.println (name);
What would happen would be that I wouldn't even get to input the name and all that would print would be the number. Conversely if I were to do:
Scanner sc = new Scanner (System.in)
int number = sc.nextInt();
String name = sc.next();
System.out.println (number);
System.out.println (name);
Then everything works swimmingly, however one can't use spaces in the string.
Why do strings being scanned act so funny after being followed by a number. If I were to just use 2 strings it wouldn't do what it seems to.
I know the work around is to put a blank line in between the two, but I would just like to know WHY this happens.