[Solved] Java Code removing new line
The lines if(Character.isWhitespace(ch)) { spaces++; } else{ if(spaces>=1) { spaces=0; fos.write(‘ ‘); fos.write(ch);} in your code ensures you condense all whitespace characters into a single space. A newline is considered a whitespace character so you skip those as well. If you don’t want to group the newline with the other whitespace in this case a … Read more