Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Tamas Szekeres
Greenhorn
Posts: 6
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:
A. HH:MM
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.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!