switch (1) 썸네일형 리스트형 자바 기초 정리: IF vs. Switch ✔️ If 문 과 Switch 문 동작 방법 - if-else if 는 조건을 걸어서 한줄 한줄 읽어가며 여러개의 control flow 가능하다. - switch 의 경우에는 변수를 입력 받아 정해 놓은 여러 값과의 일치여부를 판단하여 control flow 를 결정한다 예시 ) import java.util.Scanner; public class if_switch { public static void main (String[] args){ System.out.println("what grade is my score? "); Scanner input = new Scanner(System.in); int score = input.nextInt(); System.out.println(ifMethod(sco.. 이전 1 다음