public class _10_Break {
public static void main(String[] args) {
//Break
//์นํจ ์ง์์ ๋งค์ผ 20๋ง๋ฆฌ๋ง ํ๋งค
//for๋ฌธ
int max =20;
for (int i =1; i <= 50; i++){
System.out.println(i+"๋ฒ ์๋ ์นํจ ๋์์ต๋๋ค");
if( i==max){
System.out.println("๊ธ์ผ ์ฌ๋ฃ๊ฐ ๋ชจ๋ ์์ง๋์์ต๋๋ค.");
break; //๋ฐ๋ณต๋ฌธ ํํด
}
}
System.out.println("์์
์ข
๋ฃํฉ๋๋ค");
System.out.println("-------------");
//while๋ฌธ
int index = 1; //์๋ ๋๊ธฐ ๋ฒํธ
while(index <= 50){
System.out.println(index + "๋ฒ ์๋, ์ฃผ๋ฌธํ์ ์นํจ ๋์์ต๋๋ค.");
if(index == max) {
System.out.println("๊ธ์ผ ์ฌ๋ฃ๊ฐ ๋ชจ๋ ์์ง๋์์ต๋๋ค.");
break;
}
index++;
}
System.out.println("์์
์ ์ข
๋ฃํฉ๋๋ค.");
}
}