如果 “对象.nextInt()” 我在键盘上输入字符, 那这是属于哪一类异常?
也是说我catch()中应该怎么写?
求大神!!!!!非常感谢
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at com.lisongye.Index.main(Index.java:8)
InputMismatchException就是它吧
http://docs.oracle.com/javase/6/docs/api/java/util/InputMismatchException.html
InputMismatchException()