DEVFYI - Developer Resource - FYI

What is numeric promotion?

Java Interview Questions and Answers (part 2)


(Continued from previous question...)

340. What is numeric promotion?

Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floating-point operations may take place. In numerical promotion, byte, char, and short values are converted to int values. The int values are also converted to long values, if necessary. The long and float values are converted to double values, as required.

(Continued on next question...)

Other Interview Questions