Which correctly fills in the blank to print 2020-01-15?
LocalDate hatDay = LocalDate.of(2020, Month.JANUARY, 15); DateTimeFormatter f = DateTimeFormatter.ISO_DATE; System.out.println(___);
I. f.format(hatDay) II. f.formatDate(hatDay) III. hatDay.format(f)
C.
Both LocalDate and DateTimeFormatter have a format()
method.
This makes II incorrect.
While it is tricky, you do need to know that the format()
method can be called on either object.
Since I and III are correct, Option C is the answer.