+ 1
How to convert a string to int in java which is red during scanner function
3 odpowiedzi
+ 5
Integer.parseInt();
+ 3
@Mallikarjun h t
Why did you tag c++ here? Please remove.
+ 2
you can also instead of reading text with scanner read the input as integer with scanner.nextInt() instead of scanner.nextLine().
@Faisals answer is the universal method to convert strings to integers