Q. What is the output of the following code?
Code:int x = 10;
if (x < 5) {
System.out.println(“x is less than 5”);
} else if (x > 20) {
System.out.println(“x is greater than 20”);
} else {
System.out.println(“x is between 5 and 20”);
}
β
Correct Answer: (C)
x is between 5 and 20
Explanation: Since x is between 5 and 20, the else block is executed and “x is between 5 and 20” is