標題:
[作業] 陣列 (三) - 二維陣列
[打印本頁]
作者:
tonyh
時間:
2021-11-13 11:56
標題:
[作業] 陣列 (三) - 二維陣列
一個 3x4 的二維陣列 可存放 12 筆資料
public class Ch36
{
public static void main(String args[])
{
int n[][]={{1,2,3,4},{5,6,7,8},{9,10,11,12}};
for(int i=0; i<3; i++)
{
for(int j=0; j<4; j++)
System.out.println("n["+i+"]["+j+"]="+n[i][j]);
}
}
}
複製代碼
作者:
袁華岑
時間:
2021-11-17 13:24
public class Practice
{
public static void main(String args[])
{
int n[][]={{1,2,3,4},{5,6,7,8},{9,10,11,12}};
for(int i=0; i<3; i++)
{
for(int j=0; j<4; j++)
System.out.println("n["+i+"]["+j+"]="+n[i][j]);
}
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2