Boolean Expression With Mixed Types
Consider the following code segment.
int x = 15;
int y = 4;
double z = 3.8;
boolean valid = (x / y > z) && ((double)(x + y) / 2 <= z * 2) && (x % y != (int)z);
What is the value of valid after this code segment is executed?
A
The expression causes a runtime error
B
false
C
The expression causes a compile-time error
D
true
Question Leaderboard
Not enough data yet to show leaderboard.
