• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can someone please help me fix this error in my code ?  RSS feed

 
P. Larson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me fix this error in my code? This is the only error that I have in my code. I keep trying to fix it, but don't know how or know what it means. Thank you for the help everyone !!

Here the error : error ')' expected if(Answer1.equals("yes") || answer.equals("y") || answer.equals(" yes");


I'm trying to make a userInput program that is using String. Something that will ask the person a question. If that person says that right answer it'll print out one block of code. But if person answer the question wrong it'll print out a other block of code.

 
Tony Docherty
Bartender
Posts: 3271
82
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The message tells you what is wrong - The compiler is saying it expected a ')' so I should count the number of opening and closing brackets and see if one is missing.

BTW do you really want the semi-colon after the if statement?
 
Jay Tai
Ranch Hand
Posts: 222
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pay attention to the correct syntax for if statements:

[code=java]
// the "if" clause: bicycle must be moving
if ((condition1) (condition2)) {
//
result;
}
 
P. Larson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Thank you for the help I got everything working just fine now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!