String currentLine = reader.readLine();
while (currentLine != null)
{
String[] studentDetail = currentLine.split("");
String name = studentDetail[0];
int number = Integer.valueOf(studentDetail[1]);
currentLine = reader.readLine();
}
所以我有这样一个文件:Integer.valueOf()错误ArrayIndexOutOfBoundsException异常:
student1
student16
student6
student9
student10
student15
当我运行节目中说: ArrayIndexOutOfBoundsException异常:1
输出应该是这样的:
student1
student6
student9
student10
student11
student15
student16
你需要发布更多的代码。 –
您可以调试以查找变量名称包含的内容,因为IndexOutOfBounds指示已使用非法索引访问数组。索引或者是负数,或者大于或等于数组的大小。 –
你需要知道什么? – Camila