标签:string 定义 ++ array out col system length main
public class ArrayDemo2 { public static void main(String[] args) { //定义一个数组存放元素 int[] arr3 = {10, 20, 30, 40, 50, 60, 70, 80, 90}; //arr3.length/2 需要互换的次数 for (int i = 0; i < arr3.length / 2; i++) { //进行数组互换 int sum = arr3[i]; arr3[i] = arr3[arr3.length - 1 - i]; arr3[arr3.length - 1 - i] = sum; } for (int i = 0; i < arr3.length; i++) {//重新遍历一次数组 System.out.print(arr3[i] + " "); } } }
标签:string 定义 ++ array out col system length main
原文地址:https://www.cnblogs.com/libinhong/p/10988789.html