This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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: 4164

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: 37890
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.
Don't get me started about those stupid light bulbs.
subject: else if
Similar Threads
How do i apply font styles and sizes to a string ?
Applet not initializing
Help i need help with borderlayout
font size and style