Code:
import java.io.*;
public class app{
public static void main(String [] args)throws IOException {
char[] data = new char[1024] ;
FileReader fr = new FileReader("D:\\MyJava\\chinese\\donkey.txt");
int num = fr.read(data);
String str = new String(data, 0 , num);
System.out.println("Characters read = " + num);
System.out.println(str);
fr.close();
}
}
Code:
throws IOException