• Post Reply Bookmark Topic Watch Topic
  • New Topic

OCA / OCP Java SE 8 Programmer Practice Tests: Chapter 17 Question 14 Errata  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question is:

What format pattern would you pass to a DateTimeFormatter so it creates hour and minute output such as 02:33?

Offered answers:

B. HH:mm
C. hh:MM
D. hh:mm

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.
author & internet detective
Posts: 38014
Eclipse IDE Java VI Editor
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!