我創建在Java顯示每個座位中的二維陣列的成本的座位表:二維陣列中的Java
public class MovieTheater {
public static void main(String[] args) {
final int rows = 10;
final int columns = 10;
int i;
int j;
int[][] seating = {
{ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
{ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
{ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
{ 10, 10, 20, 20, 20, 20, 20, 20, 10, 10 },
{ 10, 10, 20, 20, 20, 20, 20, 20, 10, 10 },
{ 10, 10, 20, 20, 20, 20, 20, 20, 10, 10 },
{ 10, 10, 20, 20, 20, 20, 20, 20, 10, 10 },
{ 20, 20, 30, 30, 40, 40, 30, 30, 20, 20 },
{ 20, 30, 30, 40, 50, 50, 40, 30, 30, 20 },
{ 30, 40, 50, 50, 50, 50, 50, 50, 40, 30 }
};
然而,當我嘗試打印陣列:
for (i = 0; i < rows; i++) {
System.out.print(rows[i]);
for (j = 0; j < columns; j++) {
System.out.print(columns[j]);
}
}
}
}
我收到一條錯誤:array required, but int found
這是我的陣列格式的問題,或者我的PR語法問題int解決方案?
請在你的問題的標題更具體。它將幫助網絡中的人們找到更多相關的結果,以及SO用戶。 –