为什么在用Scanner类输入数字是加”,“,会出现错误,加空格是却是合适的。如下:
请输入两个数:
3,5
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:909)
at java.util.Scanner.next(Scanner.java:1530)
at java.util.Scanner.nextInt(Scanner.java:2160)
at java.util.Scanner.nextInt(Scanner.java:2119)
at Test2.main(Test2.java:50)
求解! |