Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I dont understand what the compiler error messages means Import java.io.file; import java.io.FileNotfoundException; import java.io.PrintWriter; import java.util.Scanner; {public class Exercise12_11 {public static void main(String[] args)
I dont understand what the compiler error messages means
Import java.io.file; import java.io.FileNotfoundException; import java.io.PrintWriter; import java.util.Scanner; {public class Exercise12_11 {public static void main(String[] args) {if (args.length != 2) {System.out.println("Invalid arguments."); System.out.println("usage: java chapter_12.Exercise_11 word filename"); System.exit(l);} Check if tha filename exist File filename = new File{args[1]); if (!filename.exists()) {System.out.println(args[l] + "does not exist*); System.out.println(2);}//create input and output files String s = ""; try {Scanner input = new Scanner(filename); While (input.hasNext()) {s = +input.nextLine();} catch (fiieNotfoundException e) {e.printStackTrace();} s = s.replaceAll(args[0], ""); try {Printwriter output = new printwriter(filename); System.out.println(s); output.write(s); output.close();} catch (FileNotfoundException e) {e.printStackTrace();} System.out.println("complete");}}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