int x = 3;
int y = 3;
if (x == y) {
System.out.println("equal");
} else {
System.out.println("not equal");
}What is printed?
- A
not equal
- Bcheck_circle
equal
- C
compile error
- D
true
Explanation
== is the equality comparison operator. x and y both equal 3, so the condition is true and "equal" is printed.