标题翻译
ArrayIndexOutOfBoundsException in Java from CSV file
问题
尝试从CSV文件中读取输入,但出现了这个错误。有人能告诉我为什么吗?
尝试从用户那里获取三个输入(姓名、身份证、GPA),都作为字符串(我知道这不是一个好的做法)。
英文翻译
trying to read the inputs from the CSV file, but got this error. Can someone tell why?
trying to take three inputs from the user (name, id, GPA) all as a string (I know it is not a good practice)
答案1
得分: 0
你读取的 CSV 文件存在不一致之处。可能是某处缺少了逗号 ,
:
12345,Molly,2.5 54321,Sally 3.5
第 2 行会导致 ArrayIndexOutOfBoundsException
。
英文翻译
There is an inconsistency with your csv file that you are reading. Probably a missing ,
somewhere:
12345,Molly,2.5
54321,Sally 3.5
Line 2 will cause an ArrayIndexOutOfBoundsException
.
专注分享java语言的经验与见解,让所有开发者获益!
评论