How do I change acceptance with decimal separator to . instead of , with input in Netbeans IDE 7.0.1?
This is within Netbeans itself like trying this –>
System.out.println("Cost?: ");
cost = keyboard.nextDouble();
If this is input with 37.5 following happens –>
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:840)
at java.util.Scanner.next(Scanner.java:1461)
at java.util.Scanner.nextDouble(Scanner.java:2387)
at Lab3_ChangeMoney.main(CostProgram.java:47)
Java Result: 1
But with input 37,5 its ok
I tried via Control Panel, but not
So this could be fixed by setting the locale to
Locale.US:Read more about localized numbers on the manual