What is the result of the following?
import java.time.*; import java.time.format.*; ? public class Main { public static void main(String[] args) { LocalDate newYears = LocalDate.of(2020, 1, 1); Period period = Period.ofDays(1); DateTimeFormatter format = DateTimeFormatter.ofPattern("mm-dd-yyyy"); System.out.print(format.format(newYears.minus(period))); } /*from w w w .ja va 2 s . c o m*/ }
D.
When creating a formatter object, remember that MM represents month while mm represents minute.
Since there are not minutes defined on a LocalDate object, the code throws an UnsupportedTemporalTypeException.