reverseLines
Category: Line-Based File Processing
Author: Stuart Reges
Book Chapter: 6.3
Problem: reverseLines
Write a static method reverseLines
that takes a Scanner containing an input file as a parameter and that echos
the input file to System.out with each line of text reversed. For example,
given the following input file:
If this method works properly,
the lines of text in this file
will be reversed.
Remember that some lines might be blank.
Your method should print the following output:
,ylreporp skrow dohtem siht fI
elif siht ni txet fo senil eht
.desrever eb lliw
.knalb eb thgim senil emos taht rebmemeR
Notice that some of the input lines can be blank lines.
Write your solution to reverseLines below.