2
u/ChuckEye Nov 30 '21
key is only one key, not a string.
1
u/coded-123 Nov 30 '21
What do I need use instead of key, I’ve looked on processing website but I don’t see what to use on keyboard function
3
7
Nov 30 '21
Oi! It's better to copy / paste your code into a "Code Block"
//string to be inputed
String dog1 = "dog";
...And copy the error message too
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.
4
u/ParthTatsuki Nov 30 '21
It is unclear what you're trying to do? Are you trying to associate a single key press with the variable dog1? If so, that's not the way to go. The 'key' will give you the key that you pressed, like 'c', not an entire string