
Write a Java progrm that copies one text file to another, converting every lower case character to upper case equivalent. Names of surces file and destination file should be passed from command line.

Java Copy File
import java.io.*;
import java.util.*;
public class CopyFile{
private static void copyfile(String srFile, String dtFile){
try{
File f1 = new File(srFile);
File f2 = new File(dtFile);
BufferedReader br=new BufferedReader(new FileReader(f1));
BufferedWriter bw=new BufferedWriter(new FileWriter(f2,true));
String line="";
while ((line = br.readLine())!=null){
bw.write(line.toUpperCase());
}
bw.close();
System.out.println("File copied.");
}
catch(IOException e){
System.out.println(e.getMessage());
}
}
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Enter source file with path: ");
String file1=input.next();
System.out.print("Enter destination file with path: ");
String file2=input.next();
copyfile(file1,file2);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.