- #1
ArthurRead
- 16
- 0
Hello everyone. I am a little confused as to how I should organize if else statements in java. Here is an example from my Leap Year program:
Is this fine? Is it against convention? Can you guys follow it easily?
Thank you
Code:
if (x<1600) {
System.out.println(setError);
} else if (x>2013) {
System.out.println(setError);
} else {
if (c == 0) {
System.out.println(leap);
} else if (b == 0) {
System.out.println(notLeap);
} else if (a == 0) {
System.out.println(leap);
} else {
System.out.println(notLeap);
}
}
Is this fine? Is it against convention? Can you guys follow it easily?
Thank you