已解决,是txt本身编码的问题,所以,我把读取文件格式改成了“GBK”
public class ReadWriteTextFile {
public static void main(String[] args){
File file = new File("F:/poem.txt");
if(file.exists()){
System.out.println("exist");
try {
FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis,"GBK");
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine())!= null){
System.out.println(line);
}
br.close();
isr.close();
fis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}