• Post Reply Bookmark Topic Watch Topic
  • New Topic

java error message  RSS feed

 
mike beauchamp
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class Lab08C {
public static void main(String[] args) {
char result = 'w';
if (result == 'W') {
System.out.println("You WIN");
}
else if (result == 'w') {
System.out.println("You WIN");
}
else if (result == 'L') {
System.out.println("You LOSE");
}
else if (result == 'l') {
System.out.println("You LOSE");
}
else
System.out.println("Rained out");
}
}
}
}
}

i keep getting an error job Lab08C.java:18 ' class ' or 'interface' expected

i think it has to do with something about the "rained out" but i don't know what to change. the "rained out" is supposed to be any other char beside 'w' or 'L'. the code worked before i added the rained out but when i take the rained out off it still doesn't work.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally when you get that error, it means you have some extraneous code outside your class definition. Look at how many end braces you have at the end of the code. Make sure that every opening and closing brace has a match.
 
mike beauchamp
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i am a beginner..thanks for the help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!