[Solved] why there is error with spaces (” “) in arrays? [closed]


Looks like you’re trying to do something like this:

static String HTMLchange(String src) {
    return src.replaceAll("ber", "vai");
}

which replaces every occurrence of “ber” in the string with “vai”

UPDATE

using in.next() fetches the next token. Whitespace is considered as a legit delimiter so when the user enters the string “x ber x” the first token is extracted as “x”. Using in.nextLine() instead will fetch the whole line and provide the required behavior.

7

solved why there is error with spaces (” “) in arrays? [closed]