I\'m new to programming and trying to nut out a basic guessing game, but I have this error. Need some help as I\'ve set \'guess\' to char, then want to compare
equals() is a method that is contained in the Object class and passed on through inheritance to every class that is created in java. And since it is a method, it can be invoked only by objects and not primitives.
You should compare the variable guess like this
if(guess==wordContainer[j]) {
hope it helps.
Primitives are compared with ==. If you convert the chars to the wrapper classes Character, then you can use .equals().
Either change
char guess; to Character guess;
or
if(guess.equals(wordContainer[j])) to if(guess == wordContainer[j])).