java数组的初始化

 

java数组的初始化方式:

class numrow{

public static void main (String[] args) {

int[] num={1,2,3,4};

System.out.println(num[0]);

int []num1;

num1=new int[3];

num1[0]=1;

System.out.println(num1[0]);

int[] num2=new int [3];

num2[0]=3;

System.out.println(num2[0]);

}

}