JAVA Program to Copy File in Uppercase

JAVA Program to Copy File in Uppercase:


/* COPY FILE TO ANOTHER IN UPPERCASE */
import java.io.*;
import java.lang.*;
class filecopy3
{
 public static void main(String args[])
 {
  BufferedReader br=null;
  BufferedWriter bw=null;
  File f1=new File(args[0]);
  File f2=new File(args[1]);
  try
  {
   br= new BufferedReader(new FileReader(f1));
   bw= new BufferedWriter(new FileWriter(f2));

   String line="";
   while((line=br.readLine())!=null)
   {
     bw.write(line.toUpperCase());
   }
  }
  catch(Exception e){}

  finally
  {
      try
      {
   br.close();
   bw.close();
}
catch(Exception e){}
  }
 }
}

Leave a Reply

Your email address will not be published. Required fields are marked *

18 − seven =

This site uses Akismet to reduce spam. Learn how your comment data is processed.