• Post Reply Bookmark Topic Watch Topic
  • New Topic

else without if error?  RSS feed

 
Muhamet Ternava
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends, i'm Muhamet from Kosovo and i'm the new member here..

I have a problem, can anyone help me? Thanks. 

Here is the code:





ERROR : else without if ?
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Take a very close look at line 13.
Examine it character by character.

By the way, don't use == to compare Strings. Use equals() instead. Or maybe equalsIgnoreCase() because you ask for Yes but test for yes.
 
Muhamet Ternava
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhamet Ternava wrote:Hello friends, i'm Muhamet from Kosovo and i'm the new member here..

I have a problem, can anyone help me? Thanks. 

Here is the code:





ERROR : else without if ?


NOW IT'S OKAY - THANKS !!
 
Campbell Ritchie
Marshal
Posts: 56581
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhamet Ternava wrote:. . . NOW IT'S OKAY - THANKS !!
No, it still looks incorrect. Just because code compiles, that doesn't mean it is correct. There were two errors, one which will stop the code compiling, and another which will cause the code to run incorrectly. Even though you have removed the ; from line 13, you might still have the other error.

As on all websites, please don't write ALL UPPER CASE.

And welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!