package com.xuyigang1234.chp01; public class Defmo6 { public static void main(String[] args) { //定义二维数组 并 静态初始化 int [][]arr=new int[][]{{1,2,3},{4,5,6},{7,8,9}}; for(int i=0;i<arr.length;i++){ for(int j=0;j<arr[i].length;j++){ System.out.print(arr[i][j]+" "); } System.out.println(); } System.out.println("+++++++++++++++++++++++++++++"); //定义二维数组 并 动态初始化 int arr1[][]=new int[3][3]; arr1[1][2]=4; //赋值 for(int i=0;i<arr1.length;i++){ for(int j=0;j<arr1[i].length;j++){ System.out.print(arr1[i][j]+" "); } System.out.println(); } } }