FileReader fr=new FileReader("D:\\Demo.txt"); char[] ch=new char[2]; int len=0; while((len=fr.read(ch))!=-1) { System.out.print(new String(ch, 0, len)); }
FileReader fr=new FileReader("D:\\Demo.txt"); int cl=0; while((cl=fr.read())!=-1) { System.out.println((char)cl); }
时间: 2024-10-18 18:46:56