zoukankan      html  css  js  c++  java
  • java数组使用 三 循环数组元素

    
    package array;
    
    public class Demo03 {
        public static void main(String[] args) {
            int[] arrays = {1, 2, 3, 4, 5, 6,7, 8, 9, 10, 11, 12, 13, 14};
            test();
    
            printArray(arrays);
        }
    
        public static void test() {
            int[] arrays = {1, 2, 3, 4, 5, 67, 8, 9, 10, 11, 12, 13, 41};
    
    //增强性 for循环
            for (int array : arrays) {
                System.out.print(array+"	");//1	2	3	4	5	67	8	9	10	11	12	13	41
            }
            System.out.println();
        }
    
    
    //打印数组元素
         public  static  void printArray(int[] arrays){
             for (int i = 0; i < arrays.length; i++) {
                 System.out.print(arrays[i]+"	");//1	2	3	4	5	6	7	8	9	10	11	12	13	14
             }
         }
    }
    
    

    运行结果

  • 相关阅读:
    8.26 树状数组
    8.27 神异之旅
    8.26 雇佣
    8.28 Jack与Rose
    8.28 ISN
    保存和加载网络
    快速搭建网络
    分类网络
    torch中的回归
    pytorch中的Variable
  • 原文地址:https://www.cnblogs.com/d534/p/15077959.html
Copyright © 2011-2022 走看看