Change locale
That said, you can use Scanner#useLocale
to change the locale Scanner
uses. For example:
scanner.useLocale(Locale.ENGLISH);
and then you can also work with 5.2
as input.
CodePudding user response:
All i had to do was using comma instead of a dot, "5,2" instead of "5.2".
Big thanks to @Zabuzard. He pointed out the solution.