View Code
import java.io.*; class copy_demo { public static void main(String[] args)throws Exception { FileReader fr=new FileReader("abc.txt"); BufferedReader bufr=new BufferedReader(fr); FileWriter fw=new FileWriter("copy_abc.txt"); BufferedWriter bufw=new BufferedWriter(fw); int num=0; while((num=bufr.read())!=-1) { String st=bufr.readLine(); bufw.write(st); bufw.newLine(); System.out.println((char)num); } for(int x=0;x<10;x++) { String ss=bufr.readLine(); if(ss!=null)System.out.println(ss); } bufw.close(); } }