Given the fragment:

float var1 = (12_345.01 >= 123_45.00) ? 12_456 : 14_56.02f;
float var2 = var1 + 1024;
System.out.print(var2);

What is the result?

A.

13480.0

B.

13480.02

C. Compilation fails
D. An exception is thrown at runtime

题解

先看到第 24 行的判断式「12_345.01 >= 123_45.00」,这很明显会成立,因此 var1 的值为「12456」。var2 的值为 12456+1024=13480。