aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "else if" Watch "else if" New topic
Author

else if

levi sleight
Greenhorn

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
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21


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


Steve
levi sleight
Greenhorn

Joined: Sep 19, 2012
Posts: 19


thanks, im dumb
Campbell Ritchie
Sheriff

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

Joined: Jan 03, 2004
Posts: 6109
    
    6

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.
 
wood burning stoves
 
subject: else if