以下代码编译,但是当我运行它时,它没有进入while循环。为什么?
while (Str1.equals(Str2)); {
count = 1;
while (count <= maxCount); {
System.out.print(something1);
count = count + 1; } }
答案 0 :(得分:2)
删除半结肠,仅为do-while添加分号。这是您的代码:
while (Str1.equals(Str2))
{
count = 1;
while (count <= maxCount)
{
System.out.print(something1);
count = count + 1;
}
}