What will be the output of the following Java code? public class IfExample {
What will be the output of the following Java code? public class IfExample {
public static void main(String[] args) {
int number = 10;
if (number > 5) {
System.out.println("Number is greater than 5");
}
}
}
Show answerHide answer
Correct answer: (C) Number is greater than 5
Explanation
number = 10, so number > 5 is true and the if block prints "Number is greater than 5".