I have this extremely simple program to reverse an array of integers but every time I try to run it, it just ignores the second loop where the reverse should happen and passes it or there maybe some trouble in it.
package chapter_1;
import java.util.*;
public class Reverse_array {
public static void main(String[] args) {
Scanner keybd = new Scanner(System.in);
int[] arr = new int[10];
for (int i = 0; i < arr.length; i++) {
System.out.println("[%" + i + "]=");
arr[i] = keybd.nextInt();
}
for (int i = 0; i < arr.length; i++) {
int temp = arr[i];
arr[i] = arr[10 - 1 - i];
arr[10 - 1 - i] = temp;
}
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i]);
}
}
}