Java OCA OCP Practice Question 144

Question

Suppose you want to use a DateFormat to format an instance of Date.

What factors influence the string returned by DateFormat's format() method?

  • A. The operating system
  • B. The style, which is one of SHORT, MEDIUM, or LONG
  • C. The style, which is one of SHORT, MEDIUM, LONG, or FULL
  • D. The locale


C, D.

Note

Date formatting is determined by the locale and by the style.

Style constants are defined as static ints in the DateFormat class: SHORT, MEDIUM, LONG, and FULL.




PreviousNext

Related