sulav.aryal
2007-06-11 22:37:30 UTC
class CopyCharacters
{
public static void main(String args[]) throws IOException
{
File infile =new File("a");
File outfile=new File("b");
FileReader fr=null;
FileWriter fw=null;
try
{
fr=new FileReader(infile);
fw=new FileWriter(outfile);
int ch;
while((ch=fr.read())!=-1)
{
fw.write(ch);
System.out.println((char)ch);
}
}
catch(IOException e)
{
System.out.println(e);
}
finally
{
try
{
fr.close();
fw.close();
}
catch(IOException e)
{}
}
}
}
/*//error :- java.io.FileNotFoundException:in.txt( The system cannot find the file specified)
Exception in thread "main" java.lang.NullPointerException at CopyBytes.main(CopyBytes.java:29) */