Whats wrong with this code?

Lucas Mulherin

Greenhorn

Posts: 4

posted 4 years ago

So, this is my first day learning Java.. or any coding at all. So yeah, I'm a noob. But I got this code going...
and it asks;
"5+5:"
And when I enter "10"
it says "You were wrong! Try again!"
but I told it to say "You are correct!" if you enter 10.
at least I think I have it set up correctly to say that.

sorry if I have any misunderstandings, all of this stuff is hard to wrap my head around at the moment

No need to apologize. We all have to start somewhere.

Oddly enough, you made the exact opposite mistake from what most beginners do. Usually people start off learning == and then try to use it for objects (usually Strings, like if (name == "Joe") ) and it doesn't work the way the expect, and we have to explain to them to use equals() for comparing objects' states (contents). Congratulations on being original!

Lucas Mulherin

Greenhorn

Posts: 4

posted 4 years ago

Oh yay! originality! Haha. Well I tried something with the '==' earlier... maybe I just didn't do it right!
Thanks for the help!