程序设计中临时变量的使用(课下测试,选做)

题目要求

  • 提交:
    编译运行没有问题后,git add . git commit -m "数组元素删除,插入" git push; 提交码云上你完成的代码的链接。

  • 任务:
    //定义一个数组,比如
    int arr[] = {1,2,3,4,5,6,7,8};

    //打印原始数组的值
    for(int i:arr){
    System.out.print(i + " ");
    }
    System.out.println();

    // 添加代码删除上面数组中的5
    ...

    //打印出 1 2 3 4 6 7 8 0
    for(int i:arr){
    System.out.print(i + " ");
    }
    System.out.println();

    // 添加代码再在4后面5
    ...

    //打印出 1 2 3 4 5 6 7 8
    for(int i:arr){
    System.out.print(i + " ");
    }
    System.out.println();

码云链接

https://gitee.com/J20175319/java20175319_jiangye/blob/master/week8/单元测试/src/Linshibianliang.java

测试结果截图

原文地址:https://www.cnblogs.com/killer-queen/p/10747491.html