int a = 5;
int b = 5;
if (a != b) {
System.out.println("X");
} else {
System.out.println("Y");
}What is printed?
- Acheck_circle
Y
- B
X
- C
true
- D
false
Explanation
a and b are equal, so a != b is false, and the else branch prints "Y".
AP Computer Science A· difficulty 2/5
int a = 5;
int b = 5;
if (a != b) {
System.out.println("X");
} else {
System.out.println("Y");
}What is printed?
Y
X
true
false
Explanation
a and b are equal, so a != b is false, and the else branch prints "Y".
Want 10 more like this — adaptive to your weak spots?
A method <codeboolean isReady()</code is called inside an <codeif</code. Which is correct?…
chevron_right<codeString label = (n == 1) ? "item" : "items";</code is equivalent to…
chevron_right<codeint x = 5; String s = (x 0) ? "pos" : (x < 0) ? "neg" : "zero";</code — s is…
chevron_right