The reason this does not work is because it charAt(int x)is a class method String, namely a function, and you cannot assign a function a value in Java.
If you want to scroll a string character by character, I may be tempted to do this:
Char[] GuessAsChar = guess.toCharArray();
Then use GuessAsChar. Depending on your needs, it might be better (as in neat) ways to approach the search for equivalence of characters in strings.
user257111
source
share