/** * Title: Chapter 3, "Control Statements" * Description: Chapter 3 Examples * Copyright: Copyright (c) 2000 * Company: Armstrong Atlantic State University * @author Y. Daniel Liang * @version 1.0 */ // TestBreak.java: Test the break keyword in the loop // package chapter3; public class TestBreak { /**Main method*/ public static void main(String[] args) { int sum = 0; int item = 0; while (item < 5) { item ++; sum += item; if (sum >= 6) break; } System.out.println("The sum is " + sum); } }