I'm supposed to write a program in java that scans 10 double numbers and then stores them in an array. The numbers are then supposed to be reversed and printed. This is what I've written. The program prints the array in the right order instead of reversed, how can i fix it?
public class ReverseNumbers {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
// Fyll i egen kod
double[] a = new double[10];
for(int i = a.length - 1; i >=0; i--){
a[i] = scan.nextDouble();
System.out.print(" " + a[i]);
}
}
}