Java多维数组(二维数组,包含方法的重载)
package com.array; public class ArrayDemo03 { public static void main(String[] args) { int[][] arrays={{1,2,3},{2,3,4,5,6},{3,4},{4,5,6,7,8,9,10}}; printArrays(arrays[3]); System.out.println("\n"+"=================="); printArrays(arrays); } /** public static void printArrays(int[] arrays){ //增强型for循环 for(int x:arrays) System.out.print(x+" "); } */ public static void printArrays(int[] arrays){ for (int i = 0; i < arrays.length; i++) { System.out.print(arrays[i]+" "); } } public static void printArrays(int[][] arrays){ for (int i = 0; i < arrays.length; i++) { for (int j = 0; j < arrays[i].length; j++) { System.out.print(arrays[i][j]+" "); } System.out.println(); } } }