What will be the output of the following program?
Correct Answer : B
main, 3 variables of type
int are declared and initialized. The first
if condition checks whether
f == d. For comparision to be done, as
d are of different types (but compatible), implicit typecasting is done.
float will be expanded to
double and comparision is done. Then
f == d means
75.0 == 75.0. This is
if block is executed. Next statement is another
f == i. Here also
int is expanded to
compared. So this equality check returns
true and display statement prints f, d and i are equal.
Topic: Nested if Statements In Java