DEVFYI - Developer Resource - FYI

What is the result of the following statement?

Java Interview Questions and Answers (part 3)


(Continued from previous question...)

406. What is the result of the following statement?

int i = 1, float f = 2.0f;
i += f; //ok, the cast done automatically by the compiler
i = i + f; //error
The compound assignment operators automatically include cast operations in their behaviors.

(Continued on next question...)

Other Interview Questions