package com.pzhu.demo;
public class ElemRev {
//Java编程定义一个数组,把这个数组中的所有元素顺序颠倒
public static void main(String[] args) {
int nums[] = {1,2,3,4,5,6,7,8,9};
int j = nums.length;
for(int i = 0;i < nums.length/2;i++){
int a = nums[i];
nums[i] = nums[j-1];
nums[j-1] = a;
j--;
}
for(int b = 0;b < nums.length;b++){
System.out.println(nums[b]);
}
}
}
09-01
4653
09-25
1484
08-07
435