nerdexam
Oracle

1Z0-851 · Question #104

Given: Float pi = new Float(3.14f); if (pi > 3) { System.out.print("pi is bigger than 3. "); } else { System.out.print("pi is not bigger than 3. "); } finally { System.out.println("Have a nice…

The correct answer is A. Compilation fails. See the full explanation below for the reasoning.

Question

Given: Float pi = new Float(3.14f); if (pi > 3) { System.out.print("pi is bigger than 3. "); } else { System.out.print("pi is not bigger than 3. "); } finally { System.out.println("Have a nice day."); } What is the result?

Options

  • ACompilation fails.
  • Bpi is bigger than 3.
  • CAn exception occurs at runtime.
  • Dpi is bigger than 3. Have a nice day.
  • Epi is not bigger than 3. Have a nice day.

How the community answered

(43 responses)
  • A
    74% (32)
  • B
    2% (1)
  • C
    7% (3)
  • D
    2% (1)
  • E
    14% (6)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice