So, the reason why
if (user.charAt(counter) = "")
gives that error is that “=” is an assignment operator in java, and so the left-hand side must be a variable. That being said, you probably actually want
if (user.charAt(counter) == ' ')
which uses the comparison operator (==) and the space character (‘ ‘). (“” is an empty string)