Text File Copy Program

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Yes.

Text File Copy Program

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.

QUESTION 7:

Can this copy program be used to copy a Microsoft Word document?