The results of the condition being tested inside the loop is not being used for anything. The condition needs to be in an if statement.
if(condition) {
do this
}else {
do that
}
Then...
Type: Posts; User: Norm
The results of the condition being tested inside the loop is not being used for anything. The condition needs to be in an if statement.
if(condition) {
do this
}else {
do that
}
Then...
use a for loop like where the array was filled. Instead of assigning a random number to the array element, compare it against the user's input.
One place I see i being used is in the for loop to index into the array where the random numbers are being stored. i does not contain a random number.
There needs to be a loop that iterates...
Where is the variable i defined and given a value?
Use this statement (with your array name) to print the contents of the array :
System.out.println("an ID "+ java.util.Arrays.toString(theArrayName));
What does the code do now?
When does it completely fill the array with numbers?
When does it ask the user for input?
Should ALL the random numbers be set BEFORE the user is asked for input?
Where is the i you are talking about defined?
Where is i assigned the random values?
What is in the variable: i?
What variable holds the index location? What problem are you having displaying the contents of that variable?