Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
它应该已经到达文件的末尾,但它没有。相反,我得到了这个奇怪的字符串,它不是空字符串,也不是空格。这是我从调试器中得到的图片。
while ( (nextLine = csvReader.readLine()) != null && (nextLine != "")) { ... }
尝试,
while( (nextLine = csvReader.readLine()) != null && !nextLine.equals("")) { ... }
我一直这样做:
Scanner scnr = new Scanner(file); while(scnr.hasNext()) { ... }
而且我认为我从来没有遇到过这样的问题。