public class daty1 { public static void main(String[] args) { int i=1, j=1; while(i<=4){ while(j<=4) System.out.print("*"); j++; } System.out.println(); i++; }}
1 回答
guozhchun
TA贡献103条经验 获得超76个赞
你应该没有把代码贴全吧。把你main函数格式化之后是这样的:
public static void main(String[] args)
{
int i = 1, j = 1;
while (i <= 4)
{
while (j <= 4) // 这个 while 循环条件永远为真,进入死循环了
System.out.print("*");
j++; // 这个语句并不是在while(j <= 4)的循环内
}
System.out.println();
i++;
}添加回答
举报
0/150
提交
取消
