1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public class ArrayTest2 { public static void main(String[] args) { String[] arr = new String[]{"JJ","DD","MM","BB","GG","AA"}; String[] arr1 = new String[arr.length]; for(int i = 0;i < arr1.length;i++){ arr1[i] = arr[i]; } for(int i = 0;i < arr.length / 2;i++){ String temp = arr[i]; arr[i] = arr[arr.length - i -1]; arr[arr.length - i -1] = temp; }
} }
|