Question: and saves Write a program that replaces every Java word in a file into the word HTML the file in the same location on
and saves Write a program that replaces every Java word in a file into the word HTML the file in the same location on disk after printing both the old lines and new lines to the output. The input file is passed to the program as a command line argument. Sample file: input.txt Welcome to Java! This is a Java program. I like programming in Java. link: https://www3.cs.stonybrook.edu/-csel14/S30/ex/input.txt Use the following statements to create a file instance and make a scanner for it: // Create a File instance java.io.File file = new java.io.File("inputFileName.txt"); // Create a Scanner for the file. Scanner input = new Scanner(file); // Read data from a file using input, e.g. input.next() // input.hasNext() determines if there's more data in the file Use the following statements to write to a file: // Create a File instance java.io.File file = new java.io.File("outputFileName.txt"); // Create the file java.io.PrintWriter output = new java.io.PrintWriter(file); // Write output to the file, this can be repeated output.print(someString); // Close the file output.close();
Step by Step Solution
There are 3 Steps involved in it
import javaioFile import javaioFileNotFoundException import javaioPrintWriter import ... View full answer
Get step-by-step solutions from verified subject matter experts
