else if (month==12);
else without if
public static void checkSeason(int month) {
if (month<=2) {
System.out.println("winter");
}
else if (month<=5) {
System.out.println("spring");
}
else if (month<=8); {
System.out.println("summer");
}
else if (month==12); {
System.out.println("winter");
}
else
System.out.println("autumn");
}
}
why?
Resolved
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Andrei
17 January 2020, 16:07
found that
; after 8) and 12)..
+2
Konstantin
17 January 2020, 16:17
pls show the full code as code (eg copy and paste your code, mark it and click "code", so it could be easier to get your question
btw the semicolons after 8 and 12 are not a good idea :)
0
Andrei
17 January 2020, 16:49
yep. noticed that already.
thank you anyway!
0