While

    반복문 (while)

    while 반복문 (기본 원리는 for문과 동일, 조건에 따라 반복할 때 사용) 조건식이 참일때 반복문 안의 문장을 실행 단, for문과 달리 (소괄호) 안에 조건식만 들어간다. while문 형식 while(조건식) { 조건식이 참일 경우 반복실행...) 조건식이 거짓이면 반복문 종료.... 홍길동 10번 찍기 package whilePractice; public class whileExam { public static void main(String[] args) { //while 문 간단 예시 (홍길동 10번 출력하기) int i = 0; while(i < 10) { i = i + 1; System.out.println(i + ". 홍길동"); } System.out.println(i); } } 실행 ..