What does the following print?
import java.time.*; import java.time.format.*; public class PolarBear { public static void main(String[] args) { LocalDate polarBearDay = LocalDate.of(2020, 2, 27); DateTimeFormatter formatter = DateTimeFormatter .ofPattern("Holiday: yyyy dd MMM"); System.out.println(polarBearDay.format(formatter)); } /*ww w.j a v a 2 s .c om*/ }
D.
The format of the pattern is incorrect.
You can't just put literal text in there.
Most of the characters of Holiday: are not defined formatting symbols.
The code throws an IllegalArgumentException, so Option D is correct.