Oracle
1Z0-851 · Question #21
Given: import java.util.Date; import java.text.DateFormat; 21. DateFormat df; 22. Date date = new Date(); 23. //insert code here 24. String s = df.format(date); Which code fragment, inserted at line…
The correct answer is E. df = DateFormat.getInstance(). See the full explanation below for the reasoning.
Question
Given: import java.util.Date; import java.text.DateFormat; 21. DateFormat df; 22. Date date = new Date(); 23. //insert code here 24. String s = df.format(date); Which code fragment, inserted at line 23, allows the code to compile?
Options
- Adf = new DateFormat();
- Bdf = Date.getFormat();
- Cdf = date.getFormat();
- Ddf = DateFormat.getFormat();
- Edf = DateFormat.getInstance();
How the community answered
(46 responses)- A9% (4)
- B2% (1)
- C2% (1)
- D7% (3)
- E80% (37)
Community Discussion
No community discussion yet for this question.