+ 3
What is wrong with the java code?
I made the following code last night but the output always says that my input is not correct as in the the last else statement of the code https://code.sololearn.com/c3x1WpOsuSIm/?ref=app
4 odpowiedzi
+ 3
In Java for comparing strings you may not use == because then the program Will compare the references and not the actual value of the string. Instead use the .equals() method, for example pPlay.equals("r")
+ 4
thanks!! it worked!
+ 3
well I thought of using char... but last time I used it it didn't work- must have made a mistake-, which brought me to think it wouldn't work until you said so
+ 1
If you need only one character, then don't use a String, just use a char data type. And compare them using single quotes (' ').
May be it'll solve the prblm. May be not. Just try!