// 将一个.java文件打印到控制台上 public static void method_01() { FileReader fr = null; try { fr = new FileReader("d.java"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } char[] s = new char[1024]; int num = 0; try { while ((num = fr.read(s)) != -1) { System.out.println(new String(s, 0, num)); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }