Reputation: 21
How get string input from user using scanner
.
e.g:
Scanner get = new Scanner(System.in);
String name = get.nextString();
But calling doesn't work with string but it works with integers or double data types.
Upvotes: 0
Views: 71
Reputation: 3759
You have to use new Scanner().nextLine()
or just new Scanner().next()
because there is no nextString()
method in the Scanner
;
Upvotes: 1