public static int countPopular(int count0, int count1, int count2) {
int result;
if (count0 > count1 && count0 > count2) {
result = 0;
}
else if (count1 > count0 && count1 > count2) {
result = 1;
}
else if (count2 > count0 && count2 > count1) {
result = 2;
}
else {
result = -1;
}
return result;
}
Having issues figuring out where I am missing parenthesis in this multi-block statement.
Message: '}' at column 7 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally).
Line: 28 Message: '}' at column 7 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally).
Line: 32 Message: '}' at column 7 should be on the same line as the next part of a multi-block statement
These are the error messages I am receiving.
Like This:
public static int countPopular(int count0, int count1, int count2) {
int result;
if (count0 > count1 && count0 > count2) {
result = 0;
}else if (count1 > count0 && count1 > count2) {
result = 1;
}else if (count2 > count0 && count2 > count1) {
result = 2;
}else {
result = -1;
}
return result;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.