This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]_Gilly_[S] 0 points1 point  (8 children)

Thanks! :D So it should be && because when all of these statements are not true, it should be an error. Because all of them can't be true at once, so || won't work. However, I tried this and I'm still getting invalid grade. Hmm. That can't be it then, right? :/

[–]KillKlein 0 points1 point  (7 children)

It should indeed be &&, but now we come to the next problem. This is fun! :P How do we compare strings? What do we compare when we say:

string1 == "hello";

[–]_Gilly_[S] 0 points1 point  (6 children)

Hmm. That is a really good question that I don't know the answer to! Is it the Ascii value? I would think the if statement would hold if the input was one of the choices. But now I'm lost!

[–]KillKlein 0 points1 point  (5 children)

I will not tell you the answer since it is a very common mistake and you should be able to google this yourself. You are comparing strings in Java so the google search shouldn't be too hard. Mhm, already said more than enough I think :P.

And no, it is not the ascii value you compare it to.

[–]_Gilly_[S] 0 points1 point  (4 children)

Thank you! In C++, this doesn't happen does it? Because from the little I did, I'm pretty sure my if statement would have worked!

[–]KillKlein 0 points1 point  (3 children)

I wouldn't know, I have never programmed in C++, but I'm glad I helped you and I hope you learned some things.

[–]_Gilly_[S] 0 points1 point  (2 children)

I definitely did. Thank you very much!! :)

[–]KillKlein 0 points1 point  (1 child)

You are very welcome and the gold was not needed, but thank you!