方法和思路都没有错就是没有遍历[code]public class Test {
public class Test {
public static void main(String[] args) {
int[] arr = {789,784,415,485};
reverseArray(arr);
}
public static void reverseArray(int[] arr) {
for (int i =0;i<arr.length/2 ;i++ ) {
int temp = arr[i];
arr[i]=arr[arr.length-1-i];
arr[arr.length-1-i]=temp;
}
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
}
|