引用 这个读文件后输出,最后的wrong doing 怎么一直有,怎么才可以在正常读文件 的最后不运行那一个语句:
package com;
import java.io.*;
public class ComIfo {
public void readTxt(String filePath) {
try {
File file = new File(filePath);
if(file.isFile() && file.exists()) {
InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "utf-8");
BufferedReader br = new BufferedReader(isr);
String[] lineTxt = null;
while ((lineTxt = br.readLine().split(",")) != null) {
System.out.println(lineTxt[0]);
}
br.close();
} else {
System.out.println(" no such file");
}
} catch (Exception e) {
System.out.println("wrong doing");
}
}
}