package chap10.sec04;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
public class Demo1 {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File file =new File("D:/测试文件.txt");
Reader reader=new FileReader(file);
char c[]=new char[1024];
int temp=0;
int len=0;
while((temp=reader.read())!=-1){
c[len++]=(char)temp;
}
reader.close();
System.out.println("读取的内容是:"+new String(c,0,len));
}
}
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
public class Demo1 {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File file =new File("D:/测试文件.txt");
Reader reader=new FileReader(file);
char c[]=new char[1024];
int temp=0;
int len=0;
while((temp=reader.read())!=-1){
c[len++]=(char)temp;
}
reader.close();
System.out.println("读取的内容是:"+new String(c,0,len));
}
}