Question: Write a java program that replaces all the occurrences of a specified string from a text file with another string. Where the user enters the

Write a java program that replaces all the occurrences of a specified string from a text file with another string. Where the user enters the name or path of the file, then enters the string that he wants to remove, and then enters the string to be added in the file instead of removed string.
Here are examples when you run the code:
Example 1:
Enter file name: test.txt
Enter the string you want to remove: Java
Enter the string you want to add: C++
Example 2:
Enter file name or path: text.txt
Source file text.txt does not exist.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!