Yes.
The following program copies a source text file to a destination text file. An already existing file with the same name as destination file will be destroyed. The names of the source and destination come from the command line. It looks like this:
java copy sourceFile to destinationFile
Most operating systems come with a user interface that includes a file copy command. The order of the source file and the destination file differs between operating systems. Getting them backwards might be disasterous! Our program requires the word "to" in the command line to ensure that the user knows the correct order.
The program will use a
FileReader
and a
BufferedReader
for input and a
FileWriter
and a
BufferedWriter
for output.