The key variable has the type char, a primitive used to store a singe character symbol. Therfore you can't compare a String to a char, because the are fundamentaly diffrent. Besides, how would you determine if cat is equal to a single keystroke, like r, or c.
It would really bennefit your post, if you wrote out the relevant code using Reddits code block system, instead of a picture of a screen displaying text.
6
u/emilfranord Nov 30 '21
The key variable has the type char, a primitive used to store a singe character symbol. Therfore you can't compare a String to a char, because the are fundamentaly diffrent. Besides, how would you determine if cat is equal to a single keystroke, like r, or c.
It would really bennefit your post, if you wrote out the relevant code using Reddits code block system, instead of a picture of a screen displaying text.