hello every one this is chileshe, am at the university of zambia..last night i was trying to work on this code,please help identify where the error is..
i wanted to read from a file which i saved as copy,now it was only reading one character. this is the code

import java.io.*;
public class Copyfile{
 public static void main(String args[]) throws IOException{
      int i;
     FileReader fr;
try{fr=new FileReader("copy.txt");}
catch(FileNotFoundException e){
e.printStackTrace();}
 do{i=fr.read();
System.out.println((char)i);}
while(i!=-1);
fr.close();
}
}

it was giving me an error that the i in the while statement could not be found