Skip to Main Content

New to Java - else without if error and not a statement

843789May 28 2010 — edited May 28 2010
I don't understand what I am doing wrong in this method. Some help would be much appreciated.

if (p1isRight ) (p2isRight ) (p3isRight ) {

System.out.println("We have a winner!");
System.out.println("Player one got it right?" + p1isRight);
System.out.println("Player two got it right?" + p2isRight);
System.out.println("Player three got it right?" + p3isRight);
System.out.println("Game is over.");
break; // game over, so break out of the loop

} else {
// we must keep going because nobody got it right!
System.out.println("Players will have to try again.");
}
}
}
}

For this segment I am getting the following error saying

java:48: not a statement

if (p1isRight ) (p2isRight ) (p3isRight ) {

java:48: ';' expected

if (p1isRight ) (p2isRight ) (p3isRight ) {

java:57: else without if

} else {

Thanks for your help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Jun 25 2010
Added on May 28 2010
10 comments
166 views