Yes, space is a character. Usually, programmers use “character” to refer to “some individual and indivisible unit of text.” When you’re writing out a string or some sequence of text, then you somehow need to mark where in that text the spaces occur.
How do you replace a special character in Java?
“java replace all special characters in string” Code Answer
String str= “This#string%contains^special*characters&.”;str = str. replaceAll(“[^a-zA-Z0-9]”, ” “);System. out. println(str);