How do you remove spaces from a string?
Answer
The replaceAll() method of the String class replaces each substring of this string that matches the given regular expression with the given replacement. You can remove white spaces from a string by replacing ” ” with “”.