package Demo03;
/*
有一个数组,a = {5,3,1,2,7,8}。将数组倒过来,即a = {8,7,2,1,3,5}。
*/
public class Demo13 {
public static void main(String[] args) {
int[] a = {5,3,1,2,7,8};
for (int i = a.length - 1; i > -1; i--) {
System.out.print(a[i] + " ");
}
System.out.println();
}
}
Java数组的倒序
最新推荐文章于 2024-08-16 10:32:59 发布