我创建在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用户。 –