Question 1
What is the result of compiling the following program? ```java public class Main { static void load() throws java.io.IOException { } public static void main(String[] args) { load(); System.out.println("loaded"); } } ```
A. loaded
main never compiles: the checked IOException that load() declares is neither caught nor declared.
B. Compilation failsCorrect answer
The catch-or-declare rule follows the DECLARATION: load() declares IOException, so main must handle or declare it (JLS 8 §11.2).
C. It compiles because load() never actually throws
The rule follows the declaration, not the body — an empty body does not excuse callers.
D. An exception is thrown at runtime
The empty body throws nothing; the failure is the compile-time catch-or-declare rule.
Explanation
The catch-or-declare rule follows the DECLARATION, not the body: load() declares IOException, so every caller must handle or declare it — even though the body is empty (`It compiles because load() never actually throws` is wrong). main needs try-catch or its own throws clause.