#Don't know why this If statement isn't working or if I did something wrong

9 messages · Page 1 of 1 (latest)

restive flower
#

Working on this small guessing game for hwk dont know what I did wrong please help.

woven basinBOT
#

This post has been reserved for your question.

Hey @restive flower! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

cobalt olive
#

when comparing Strings you should use .equals() instead of == ...

If two strings compared with == refer to the same string memory, the return value is true; if not, it is false

#
String myString = "hello";
String myOtherString = "hello";

myString.equals(myOtherString);
restive flower
#

oh so I should write

if(guess1.equals(answer))

cobalt olive
#

yeah thats better =p

restive flower
#

Thanks dude

woven basinBOT
# restive flower Thanks dude

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.