- 异常:
- InputMismatchException —输入不匹配异常
- ArithmeticException : / by zero —算术异常,除数不能为0
- FileReader
- FileReader cannot be resolved to a type —是一个无法引用的类
- The constructor FileReader() is undefined —构造函数FileReader()未定义
- java.lang.IndexOutOfBoundsException: Index: 100, Size: 5
- Exception in thread “main” java.lang.StringIndexOutOfBoundsException: String index out of range: 5
- Void methods cannot return a value
异常:
运算:System.out.println(a/b);
输入 8/2.2
InputMismatchException —输入不匹配异常
ArithmeticException : / by zero —算术异常,除数不能为0
FileReader
FileReader cannot be resolved to a type —是一个无法引用的类
The constructor FileReader() is undefined —构造函数FileReader()未定义
java.lang.IndexOutOfBoundsException: Index: 100, Size: 5
报错原因:
li.remove(100);
没有下标为100的元素,数组下标超出范围了
解决方案:
输入数组下标范围内的数即可
Exception in thread “main” java.lang.StringIndexOutOfBoundsException: String index out of range: 5
报错原因:
StringIndexOutOfBoundsException:
字符串索引自动边界异常,超出范围辽,
解决方案:
输入范围内的字符串索引
Void methods cannot return a value
报错原因:
Void方法不能返回值
解决方案:
把void换成其他类型即可
java.lang.ClassNotFoundException: cn.tedu.play323.Student
报错原因:
没有这个cn.tedu.play323.Student名,就是这个路径名写错了
解决方案:
修改为:cn.tedu.play323.Student1
count cannot be resolved to a variable
报错原因:
这个变量无法引用
解决方案
要么去创建这个变量,要么去除这个变量
Syntax error, insert “;” to complete BlockStatements
报错原因:
缺少;号
解决方案:
语法错误,请插入“;”以完成BlockStatements
