JAVA/3. Control
if~else
날아올라↗↗
2015. 12. 20. 16:35
728x90
반응형
- package test.com;
- public class Test01ifelse {
- public static void main(String[] args) {
- // 제어문 : 분기문, 반복문
- // 분기문 : if, if~else, if~else if~else if..., if~else if~else
- // switch~case 비교대상: ~default:
- // 반복문 : for, while, do~while
- int su = 2;
- if (su == 0) {
- System.out.println("AAA");
- } else if (su == 1) {
- System.out.println("BBB");
- } else if (su == 2) {
- System.out.println("CCC");
- }
- else {
- System.out.println("Other");
- }
- if ('A' == 65) {
- System.out.println("A");
- if (3 + 5 == 8) {
- System.out.println("888");
- if (true) {
- System.out.println(true);
- }
- } else {
- System.out.println("000");
- }
- }
- System.out.println("end...");
- }
- }
728x90
반응형