Hello,
I am beginning to enjoy writing noob codes in java, but i am kinda lost here. please check the code below and tell me why the 2nd else if part is not displaying hurray you are welcome. it's always going to the else part. i feel i have met the conditions for it to display the hurray part.please advise me on what to do.
I just ran that code, and I got the output "hurray you are welcome". Are you sure the code you are running is the code you just posted?
A couple of things about your if statements, though:
- (toyin <= 18 && toyin == 18) is just the same as (toyin == 18). If the second part is true the first must be.
- (toyin == 18 || toyin == 19) in this context is that same as (toyin == 19). If toyin is 18 then the execution would never reach that line because the first if condition would be true.
@Mathew Brown, If it returned hurray after you ran it, then i must have been right, but the netbeans ide is not showing that . Why is my IDE returning the else statements below ?
Hello,
When i used notepad++ to write the same code, I compiled it in command prompt and got the following error message.I wonder why it is running in Net beans . The error message. Exception in thread "main" java.lang.NoClassDefFoundError ifThenElse <wrong name: ifThenElse/ifThenElse> .It had some package extensions below.
Regarding your Notepad++ question, I saw your other post first and answered it there, please do not ask the same question in multiple posts. I'll leave this post open because I think you are still asking questions related to your original question.