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)- A74% (32)
- B2% (1)
- C7% (3)
- D2% (1)
- E14% (6)
Community Discussion
No community discussion yet for this question.