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; }}
添加回答
舉報
0/150
提交
取消