class FillArray { public static void main (String args[]) { int[ ][ ] matrix = new int[4][5]; //二维数组的声明和创建 for (int row=0; row < 4; row++) { for (int col=0; col < 5; col++) { matrix[row][col] = row + col; //二维数组的访问,为元素赋值 } } } }//源代码片段来自云代码http://yuncode.net