Home Segments Top Top Previous Next

92: Mainline

When an arithmetic expression contains values that have a mixture of data types, it is called a mixed expression. When Java evaluates a mixed expression, it first uses the given values to produce a set of values that have identical types. Then, Java performs the prescribed arithmetic.

Thus, when given a mixed expression that multiplies a floating-point number by an integer, Java first produces a floating-point number from the integer, and then multiplies.