• Post Reply Bookmark Topic Watch Topic
  • New Topic

Syntax error on token(s), misplaced construct(s)  RSS feed

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What does the following compile error mean for line 8: "Syntax error on token(s), misplaced construct(s)"

 
Arend van der Kolk
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that because after option 1(if) and option2 (else if) there is no options left?

And my code above suggests there is another option left over so the whole if statement does not make sense anymore. If i remove option 3 like below it compiles fine.

 
Sheriff
Posts: 4289
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the second if.
 
Knute Snortum
Sheriff
Posts: 4289
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arend van der Kolk wrote:Is that because after option 1(if) and option2 (else if) there is no options left?

No, it's because there is no condition after the second if.
 
Ranch Hand
Posts: 449
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You using multi-way if-else statement. For the else if, you should add one more condition.

Example

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!