QuestionQ177

Using Operators and Decision Constructs

Given this code fragment:

Question Image

What is the output?

  • A An exception is thrown at runtime.
  • B Compilation fails.
  • C 13480.0
  • D 13480.02
Explanation

Underscores within Java numeric literals are ignored. Since 12345.01 is greater than 12345.00, the conditional expression selects 12456.02f. Adding 1024 yields the float value printed as 13480.02.

Community Discussion

No comments yet. Be the first to start the discussion!