123456789101112131415161718192021 |
- package com.loveCoding.homework.j20250517;
- /**
- * @author WanJl
- * @version 1.0
- * @title T2
- * @description
- * **2. 逆序输出数组**
- * 要求:将数组元素按逆序输出(不需要真正修改数组)
- * 示例输入:`{9, 6, 3, 7, 2}`
- * 示例输出:`2 7 3 6 9`
- * @create 2025/5/24
- */
- public class T2 {
- public static void main(String[] args) {
- int[] arr={9, 6, 3, 7, 2};
- for (int i = arr.length-1; i >=0 ; i--) {
- System.out.print(arr[i]+"\t");
- }
- }
- }
|