请问下关于FileReader里面的read方法
package com.yaxing.io;import java.io.FileReader;import java.io.IOException;public class FileReaderDemo { /** * @param args */ public static void main(String[] args) { FileReader fw = null; try { fw = new FileReader("c:\\w.txt");// int ch = 0;// while ((ch = fw.read()) != -1) {// System.out.println("读取:" + (char) ch);// } while ((fw.read()) != -1) { System.out.println("读取:" + (char)fw.read()); } } catch (IOException e) { e.printStackTrace(); } finally { if (fw != null) { try { fw.close(); } catch (IOException e) { e.printStackTrace(); } } } }}读取:s读取:c读取:1读取:3读取:
asdcr1231
while ((fw.read()) != -1) { System.out.println("读取:" + (char)fw.read()); }