public static void main(String[] args) {
Demo05 hellDemo05 = new Demo05();
int[][] nums = hellDemo05.getArray(4, 5);
System.out.println(Arrays.toString(nums));
}
public int[][] getArray(int lengthA,int lengthB){
int[][] nums = new int[lengthA][lengthB];
//for循环遍历数组
for (int i = 0; i <lengthA; i++) {
for (int j = 0; j <lengthB; j++) {
//随机生成数
nums[i][j] = (int)(Math.random()*100);
System.out.println();
}
}
return nums;
}
}
sixGod
相关分类