Answered step by step
Verified Expert Solution
Link Copied!

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 meansimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+Have they changed the way employees view IP?

Answered: 1 week ago