为什么编译的时候,总提示: Test8.java:13: 错误: 需要'}' }; ^ 1 个错误

Foresea 2012-10-22 10:31:51
class Test8
{
public static void main(String[] args)
{
int[][] map={
{{0,0,0,1,0,0,0},
{0,0,1,0,1,0,0},
{0,1,0,0,0,1,0},
{1,0,0,0,0,0,1},
{0,1,0,0,0,1,0},
{0,0,1,0,1,0,0},
{0,0,0,1,0,0,0}
};
for(int row=0;row<map.length;row++){
for(int col;col<map.length;col++){
switch(map[row][col]){
case 0:
System.out.print(' ');
break;
case 1:
System.out.print('*');
break;
}
System.out.println();
}
}
}
}
...全文
153 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Foresea 2012-10-23
  • 打赏
  • 举报
回复
看到了,前面多了一个[Quote=引用 2 楼 的回复:]

int[][] map={

这里的大括号,你没有匹配,后面明显少写了一个。
[/Quote]
Foresea 2012-10-23
  • 打赏
  • 举报
回复
是两个呀,最后头[Quote=引用 2 楼 的回复:]

int[][] map={

这里的大括号,你没有匹配,后面明显少写了一个。
[/Quote]
老紫竹 2012-10-23
  • 打赏
  • 举报
回复
int[][] map={

这里的大括号,你没有匹配,后面明显少写了一个。
LiangGzone 2012-10-22
  • 打赏
  • 举报
回复

class Test8
{
public static void main(String[] args)
{
int[][] map={{0,0,0,1,0,0,0},{0,0,1,0,1,0,0},{0,1,0,0,0,1,0},{1,0,0,0,0,0,1},{0,1,0,0,0,1,0},{0,0,1,0,1,0,0},{0,0,0,1,0,0,0}};
for(int row=0;row<map.length;row++){
for(int col=0;col<map.length;col++){
switch(map[row][col]){
case 0:
System.out.print(' ');
break;
case 1:
System.out.print('*');
break;
}
System.out.println();
}
}
}
}

51,409

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧