OCA / OCP Java SE 8 Programmer Practice Tests: Chapter 17 Question 14 Errata
posted 4 months ago
What format pattern would you pass to a DateTimeFormatter so it creates hour and minute output such as 02:33?
Answer, according to Answers to Review Questions:
D. For dates, a lowercase m means minute while an uppercase M means month. This eliminates Options A and C. A lowercase h means hour. Therefore, Option B is incorrect, and Option D is the answer.
Correct answer: both lowercase h and uppercase H means hour. The difference is the first one is 12h format, the second is 24h. Since the question only says 02:33, both options B and D should be acceptable, or the question should be further specified about not displaying hours greater than 12.