I have written a for loop which counts each value in an array and if that array contains a given number (numberIn) that the user has entered, then a relavent error will appear.
However I noticed that I get a dead code warning on i++ as it only iterates once. Is there a way for the loop to iterate fully?
for (int i = 0; i < array.length; i++) {
if (!(numberIn == array[i]))
System.out.println("WRONG!!!!!");
break;
}
Aucun commentaire:
Enregistrer un commentaire