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。