package ba; import java.io.*; public class zifuTest { public static void main(String[] args) { FileInputStream fis=null; InputStreamReader reader=null; File f=new File("G:/javakc.txt"); try { fis=new FileInputStream(f); reader=new InputStreamReader(fis); // 创建字符数组 char[]c=new char[2]; // 长度 int len=0; try { while((len=reader.read(c))>0){ String str=new String(c,0,len); System.out.print(str); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }