Thursday, November 1, 2012

Java Exercise #40: Replace Text In File

The problem is to write a program that replaces all occurrences of a String in the file. The program uses Scanner class to read from the file and PrintWriter to write to the file.

Exercise: Write a program that replaces all occurrences of a String in a file. Replace "world" with "universe".


####hello_world.txt###
Hello world!
Good Morning world!

###hello_universe.txt###
Hello universe!
Good Morning universe!



Download Code: Replace Text In File

No comments:

Post a Comment