This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 8 in Action this week in the Java 8 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: 3971
    
  17


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: 36599
    
  16
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: else if
 
Similar Threads
Help i need help with borderlayout
font size and style
Applet not initializing
How do i apply font styles and sizes to a string ?