+ 3

Java Scanner Input Length

Hello everybody, can anyone tell me how to find the length of an Scanner Input? Because I want to do a program, which is printing out the length of the typed name. Sorry for my bad English because I am a german. https://code.sololearn.com/c5gn6J16jqZj/?ref=app

30th Jun 2017, 9:50 PM
reqqu
reqqu - avatar
6 ответов
+ 4
Strings have a length() method you can use. Example/ String input = scannerName.nextLine(); input.length(); // this is the length of the String.
30th Jun 2017, 9:53 PM
Rrestoring faith
Rrestoring faith - avatar
+ 4
And please ignore the test lines.
30th Jun 2017, 9:51 PM
reqqu
reqqu - avatar
+ 3
Thanks for this! 😉
30th Jun 2017, 11:13 PM
reqqu
reqqu - avatar
+ 3
@WebTop I don't understand, you want to take the length of a number?
7th Jul 2017, 6:20 PM
Rrestoring faith
Rrestoring faith - avatar
- 2
I do not know how to do this it says write a numner
7th Jul 2017, 6:10 PM
WebTop Three
WebTop Three - avatar
- 2
sorry NUMBER
7th Jul 2017, 6:10 PM
WebTop Three
WebTop Three - avatar