flag1がtrueなので、whileループが開始されます。 最初にflag1 = falseとなり、if条件に入りますが、flag1 == flag2がfalseなので、continueが実行されません。 その結果、System.out.print("B")が出力されます。 その後、break文が実行されてループが終了します。
150記事のステップ学習 1記事=1テーマ。例題・コードサンプル付きで、無理なく理解を進められる。 試験対策+実務応用 単なる暗記ではなく、実務で役立つJavaスキルを同時に習得可能。 初学者でも安心 白本の難解な内容をかみ砕き、段階的にステップ ...
In Java, break and continue are control flow statements used within loops (such as for or while) to alter the normal flow of execution. The break statement is used to terminate the loop prematurely.