This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes else if Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "else if" Watch "else if" New topic

else if

levi sleight

Joined: Sep 19, 2012
Posts: 19
so. i treid to do 2 else ifs and it tells me it wont work. heres all my code

on line 36 it says "syntax error on token "else" delete this token"

p.s: im useing eclipse
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

line 34 - typo- semicolon after else if ()
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

That is line 34 on your original code. There is an extra ; character after the if - that denotes the end of the if statement, which is immediately followed by a block which is independent of the if statement, therefore the following else clause is not applicable. You should remove the ; on that line

levi sleight

Joined: Sep 19, 2012
Posts: 19

thanks, im dumb
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46424
Not at all. Lots of people make that mistake.
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

And even with experience, we don't necessarily stop making the mistake, but all the practice we've had making it makes us better at recognizing it when it happens.
I agree. Here's the link:
subject: else if
It's not a secret anymore!