public class TiaoShi {
public static void main(String[] args) {
int[][] array = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } };
System.out.println(m1(array)[0]); //相当于result[0],result[1]
System.out.println(m1(array)[1]);
}
public static int[] m1(int[][] m) {
int[] result = new int[2];
result[0] = m.length; //2行
result[1] = m[0].length; //4列
return result; // int[] result = {2,4};
}
}
//输出结果
// 2
// 4