이 글은 2019년 홍익대학교 자바 겨울 특강 수업을 메모한 것이다.
당시에는 에버노트에 메모해놨었기 때문에,
티스토리 블로그를 시작하면서 백업해둔다.
for문과 while문은 용도가 같다.
do while문 : 일단 실행하고 조건 보자! 는 뜻.
package chapter4;
public class while_ex {
public static void main(String[] args) {
int i = 1, j = 1;
while (i <= 10) {
System.out.println(i);
i++;
}
do {
System.out.println(j);
j++;
} while (j <= 10);
}
}
'┝ 개발 언어 > ┎ JAVA' 카테고리의 다른 글
1/23 배열 (0) | 2022.03.01 |
---|---|
1/21 제어문 break, continue (0) | 2022.03.01 |
1/21 제어문 for문 (0) | 2022.03.01 |
1/21 제어문 switch case (0) | 2022.03.01 |
1/18 제어문 if문 (0) | 2022.03.01 |