5
問題很簡單的一個專家如何硬代碼中定義了一個矩陣整數[] []
Integer[][] res= new Integer[][] {.....hard code some values here on 2 dim...}
如何回到這裏2行3周的cols這樣
1 2 3
4 5 6
問題很簡單的一個專家如何硬代碼中定義了一個矩陣整數[] []
Integer[][] res= new Integer[][] {.....hard code some values here on 2 dim...}
如何回到這裏2行3周的cols這樣
1 2 3
4 5 6
int[][] res = {{1,2,3},
{4,5,6}};
這應該工作。 (但我不是Java專家)。
Integer [][] ints = { {1, 2, 3}, {4, 5, 6} };
好,但沒有問題想要一個整數,而不是一個int?有一個微妙的區別.... – mikera 2010-05-21 11:08:10
@mikera - 我敢肯定OP可以從這裏處理它... – 2010-05-21 15:24:53
@mikera:你可以將int []轉換爲Integer [] – 2014-09-22 03:12:00