This question already has an answer here:
Here I have a function that calculates the sum of the values of an array
public static String oddOrEven(int[] array) {
String result;
if (array.sum() % 2 = 0) {
result = "even";
return result ;
} else {
result = "odd";
return result;
}
}
public static void main(String[] args) {
int[] myArray = {2,9,7,1,3};
oddOrEven(myArray);
}
But it shows an error saying "cannot find symbol"
Aucun commentaire:
Enregistrer un commentaire