
New Programming/Java 2020. 7. 14.
<자바> break 문 - 흐름 제어문
오늘은 자바에서 사용하는 break문에 대해서 알아보겠습니다. 흐름 제어문이라고도 말하는 break문은 주로 반복문을 제어할 때 사용하게 됩니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 /* * break문 * * if문과 함께 사용하는 경우가 다반사고, * 해당 break문을 만나면 반복문을 탈출하게 된다. * */ public class BreakEx { public static void main(String[] args) { for(int i=10; i>0; i--) { System.out.println("카운트 다운을 시작합니다.\n" + i + "초전"); } System.out.println("Boom!!"); } } Colored by Color Scrip..
