Question: Write a method called collapseSpaces that accepts a Scanner representing an input file as its parameter, then reads that file and outputs it with all
Write a method called collapseSpaces that accepts a Scanner representing an input file as its parameter, then reads that file and outputs it with all its tokens separated by single spaces, collapsing any sequences of multiple spaces into single spaces. For example, consider the following text:
many spaces on this line!
If this text were a line in the file, the same line should be output as follows:
many spaces on this line!
Step by Step Solution
3.48 Rating (171 Votes )
There are 3 Steps involved in it
public static void collapse Spaces Scanner input while ... View full answer
Get step-by-step solutions from verified subject matter experts
