*二维数组的初始化

package com.chongrui.test;

/*
*二维数组的初始化
* */


public class test {

public static void main(String[] args) {

int a[][]=new int[3][4];
System.out.println("输出3行4列的数组");
for(int i=0;i<a.length;i++){
for(int j=0;j<a[i].length;j++){//遍历数组当中的每个元素,
System.out.print(a[i][j]+" ");//将数组当中每个元素输出
}
System.out.println(" ");

}


}
}

 

输出3行4列的数组
0 0 0 0
0 0 0 0
0 0 0 0

 

posted @ 2017-01-15 22:09  tantanba  阅读(182)  评论(0编辑  收藏  举报