Programs Using Different Control Structures (Switch, If, While, Do, For etc.,)

class ControlStructures {
    public static void main(String[] args) {
        int x = 2;
        if (x > 1) 
            System.out.println("x > 1");
        switch (x) {
            case 1: System.out.println("One"); break;
            case 2: System.out.println("Two"); break;
            default: System.out.println("Other");
        }
        int i = 1;
        while (i <= 3) { 
            System.out.println("While " + i); 
            i++; 
        }
        int j = 1;
        do { 
            System.out.println("DoWhile " + j); 
            j++; 
        } while (j <= 2);
        for (int k = 1; k <= 3; k++) 
            System.out.println("For " + k);
    }
}