Question 1
What is the output of the following program? ```java import java.time.Duration; import java.time.LocalTime; public class Main { public static void main(String[] args) { Duration d = Duration.between( LocalTime.of(9, 0), LocalTime.of(11, 30)); System.out.println(d); } } ```
A. Compilation fails because Duration requires LocalDateTime arguments
Duration.between works with LocalTime; it does not require LocalDateTime.
B. 02:30
Duration prints in ISO-8601 duration form, not as a clock time.
C. PT2H30MCorrect answer
Correct: the two-and-a-half-hour gap prints with the mandatory PT prefix.
D. P2H30M
The T separating date and time components is mandatory before the hours; dropping it is invalid.
Explanation
Duration measures a time-based amount and prints in ISO-8601 with a PT prefix. Duration.between accepts any time-capable temporal, so two LocalTime values are valid arguments.