What is a possible output of the following?
LocalDate date = LocalDate.of(2020, 5, 13); LocalTime time = LocalTime.of(10, 0); LocalDateTime trainDay = LocalDateTime.of(date, time); Instant instant = trainDay.toInstant(); instant = instant.plus(1, ChronoUnit.DAYS); System.out.println(instant);
C.
An Instant represents a specific moment in time using GMT.
Since LocalDateTime does not have a time zone, it cannot be converted to a specific moment in time.
Therefore, the toInstant()
call does not compile, and Option C is correct.