Oracle
1Z0-851 · Question #225
Given: public class LineUp { public static void main(String[] args) { double d = 12.345; // insert code here } } Which code fragment, inserted at line 4, produces the output | 12.345|?
The correct answer is F. System.out.printf("|%7.3f| \n", d). See the full explanation below for the reasoning.
Question
Given: public class LineUp { public static void main(String[] args) { double d = 12.345; // insert code here } } Which code fragment, inserted at line 4, produces the output | 12.345|?
Options
- ASystem.out.printf("|%7d| \n", d);
- BSystem.out.printf("|%7f| \n", d);
- CSystem.out.printf("|%3.7d| \n", d);
- DSystem.out.printf("|%3.7f| \n", d);
- ESystem.out.printf("|%7.3d| \n", d);
- FSystem.out.printf("|%7.3f| \n", d);
How the community answered
(23 responses)- A9% (2)
- C17% (4)
- E4% (1)
- F70% (16)
Community Discussion
No community discussion yet for this question.