package excise;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class PrintMyself {
public static void main(String[] args) {
FileReader fr = null;
try {
fr = new FileReader("src/excise/PrintMyself.java");
char[] chars = new char[100];
int redCount=0;
while ((redCount = fr.read(chars)) != -1){
System.out.print(new String(chars,0,redCount));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
打印结果