if

    조건문 if (if ~ else , if ~ else if ~ else)

    if 문 조건식 결과값이 true면 스코프 안의 문장이 실행되고 false일 경우 실행하지 않는다. 예제 if(조건식) { // 조건식이 참일 경우 수행 } 짝수, 홀수 확인 public void method1() { int nNum = 0; Scanner s = new Scanner(System.in); System.out.printf("Insert Integer: "); nNum = s.nextInt(); if(nNum % 2 == 0) { System.out.printf("%d is Even", nNum); } if(nNum % 2 != 0) { System.out.printf("%d is Odd", nNum); } } 결과값 Insert Integer: 41 41 is Odd Insert Inte..

    조건문(제어문)

    조건문 실행 흐름을 사용자 마음대로 바꿀 수 있다. 조건을 만족할 때만 스코프{ }를 수행 종류 if 문 if ~ else 문 if ~ else if 문 switch 문