Java OCA OCP Practice Question 2253

Question

Consider this code segment:

DateTimeFormatter formatter =
        DateTimeFormatter.ofPattern("EEEE", Locale.US);
System.out.println(formatter.format(LocalDateTime.now()));

Which of the following outputs matches the string pattern EEEE given in this code segment?.

  • A. F
  • B. Friday
  • C. sept
  • D. september


B.

Note

E is the day name in the week; the pattern EEEE prints the name of the day in its full format.

"Fri" is a short form that would be printed by the pattern "E", but EEEE prints the day of the week in full form: for example, "Friday".

Because the locale is Locale.US, the result is printed in english.

the output "sept" or "september" is impossible because E refers to the name in the week, not in a month.




PreviousNext

Related