How to use "lenght" on Scanner? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
17th Jun 2019, 3:34 PM
White_145 Gaming
White_145 Gaming - avatar
3 Answers
+ 2
but this way you lost scanned line and you get only its length
18th Jun 2019, 6:18 AM
zemiak
+ 7
Scanner sc = new Scanner(System.in); int stringLength = sc.nextLine().length(); System.out.print(stringLength);
17th Jun 2019, 4:05 PM
D_Stark
D_Stark - avatar
+ 2
Can you explain your idea? I don't understand where you're going with that code : )
17th Jun 2019, 3:47 PM
Ipang