IN JAVA Write a program that replaces each line of a file with its reverse. For example, if you run java Reverse HelloPrinter.java Create the output as HelloPrinterReverse.java. If the file HelloPrinter.java contains the text public class HelloPrinter { public static void main(String[] args) { // Display a greeting in the console window System.out.println("Hello, World!"); } } ?? then the contents are changed to retnirPolleH ssalc cilbup { )sgra ][gnirtS(niam diov citats cilbup { wodniw elosnoc eht ni gniteerg a yalpsiD // ;)"!dlroW ,olleH"(nltnirp.tuo.metsyS } } If there is a blank line in the input file, do not print it in the output file. If you run Reverse twice on the same file, you get back the original file. Create the output file as HelloPointerOriginal.java java Reverse HelloPrinterReverse.java If the input file doesn’t exist, throw the message “Input file not found. Please check an rerun the program”. Allow the user to enter the input file one more time. If the user enters an invalid file again, terminate the program. Use a try... catch statement.
IN JAVA Write a program that replaces each line of a file with its reverse.
For example, if you run java Reverse HelloPrinter.java Create the output as HelloPrinterReverse.java. If the file HelloPrinter.java contains the text public class HelloPrinter { public static void main(String[] args) { // Display a greeting in the console window System.out.println("Hello, World!"); } } ?? then the contents are changed to retnirPolleH ssalc cilbup { )sgra ][gnirtS(niam diov citats cilbup { wodniw elosnoc eht ni gniteerg a yalpsiD // ;)"!dlroW ,olleH"(nltnirp.tuo.metsyS } } If there is a blank line in the input file, do not print it in the output file. If you run Reverse twice on the same file, you get back the original file.
Create the output file as HelloPointerOriginal.java java Reverse HelloPrinterReverse.java If the input file doesn’t exist, throw the message “Input file not found. Please check an rerun the program”. Allow the user to enter the input file one more time. If the user enters an invalid file again, terminate the program. Use a try... catch statement.
![.. P10.8 Write a program that replaces each line of a file with its reverse. For example, if you
run
java Reverse HelloPrinter.java
then the contents of HelloPrinter.java are changed to
retnirPolleH ssalc cilbup
{
) sgra ] [gnirtS(niam diov citats cilbup
{
wodniw elosnoc eht ni gniteerg a yalpsiD//
;)"!dlrow ,olleH"(nltnirp.tuo.metsyS
}
}
Of course, if you run Reverse twice on the same file, you get back the original file.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7cdf05f2-d4f6-4d1d-9209-282fb7748189%2F31b2736d-f82f-4447-9e14-4160211f9460%2F5fr1aze_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)