合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
``` // "static void main" must be defined in a public class. public class Main { private static void printArray(int[][] a) { for (int i = 0; i < a.length; ++i) { System.out.println(a[i]); } //二维数组行方向的长度 for (int i = 0; i < a.length; ++i) { //二维数组列方向的长度 for (int j = 0; a[i] != null && j < a[i].length; ++j) { System.out.print(a[i][j] + " "); } System.out.println(); } } public static void main(String[] args) { System.out.println("Example I:"); int[][] a = new int[2][5]; printArray(a); System.out.println("Example II:"); int[][] b = new int[2][]; printArray(b); System.out.println("Example III:"); b[0] = new int[3]; b[1] = new int[5]; printArray(b); } } ```