Question
Write a Java program name Extract.java that takes several command line parameters. The first parameter should be interpreted as the name of a source file,
Write a Java program name Extract.java that takes several command line parameters. The first parameter should be interpreted as the name of a source file, the second as the name of a target file, and then any parameters after that should be integers and will be interpreted as a set of indices. The program should create a new target file with the specified name. It should then copy from the source file the line numbers indicated by the indices provided on the command line. For example, suppose the program is run using the command line: java Extract source.txt target.txt 4 1 7 2 8 and suppose the file source.txt contains the following contents ice nice green red today blue computer yell scream shout fight then the program should create a file named target.txt whose contents should be: ice nice red computer yell
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started