Question 1
What is the result of compiling the following program? ```java import java.time.LocalDate; public class Main { public static void main(String[] args) { LocalDate d = new LocalDate(); System.out.println(d); } } ```
A. Today's date
This assumes a public no-arg constructor that defaults to the current date; LocalDate has no such constructor, and today's date comes from LocalDate.now().
B. 1970-01-01
This imagines a constructor defaulting to the epoch; there is no public constructor to invoke, so the code never runs.
C. An exception is thrown at runtime
The failure happens at compile time because the constructor does not exist, so no runtime exception is reached.
D. Compilation failsCorrect answer
The java.time classes expose no public constructors, so `new LocalDate()` cannot resolve and the program fails to compile; instances come only from static factories like now() and of().
Explanation
The java.time classes have NO public constructors — they are created exclusively through static factory methods: LocalDate.now() for today, LocalDate.of(y, m, d) for a specific date. `new LocalDate()` is a compile error.