Java中数组初始化
package com.run; public class ArayDemo08 { public static void main(String[] args) { ArayDemo08 Y = new ArayDemo08(); int S = Y.test(); int X = Y.test2(); System.out.println(S + X); } //java中数组初始化 //1.静态初始化 public int test(){ int[] A = {1,2,3,4}; for(int s: A){ System.out.println(s); } return 0; } //动态初始化 public int test2(){ int[] B = new int[10]; B[2] = 100; return B[2]; } }