So I have to write a program that accepts 10 numbers (ints) from the keyboard. Each number is to be stored in a different element of an array. Then my program must then display the contents of the array in reverse order.
int [] array = new int [10];
for(int i = array.length - 1;i >= 0; i--)
{
int number = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter number " + (i+1)));
array[i] = number;
}
JOptionPane.showMessageDialog(null, array[i]);
}
I tried to put the JOPtionPane.showMessageDialog outside of the loop but then the program can't find the integer "i". I don't know what to do here :/ Please help :P