JAVA/3. Control
Switch~Case~Break
날아올라↗↗
2015. 12. 20. 16:49
728x90
반응형
- package test.com;
- public class Test06SwitchCaseBreak {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- System.out.println("switch ~ case ~ default ~ break;");
- // 정수비교
- int x = 100;
- switch (x) {
- case 100 :
- System.out.println("A++");
- boolean bool = false;
- if(bool = x%2 == 0) {
- System.out.println("짝수");
- }
- System.out.println(bool);
- break; //if문의 블럭을 제외한 가장 가까운 블럭의 끝을 빠져나가라.
- case 90 :
- System.out.println("A");
- break;
- case 80 :
- System.out.println("B");
- break;
- default :
- System.out.println("Other");
- }
- }
- }
728x90
반응형