Given:
1. class TestException extends Exception { }
2. class A {
3. public String sayHello(String name) throws TestException {
4. if(name == null) throw new TestException();
5. return “Hello ” + name;
6. }
7. }
8. public class TestA {
9. public static void main(String[] args) {
10. new A().sayHello(“Aiko”);
11. }
12. }
Which statement is true?
A.
Compilation succeeds.
B.
Class A does not compile.
C.
The method declared on line 9 cannot be modified to throw TestException.
D.
TestA compiles if line 10 is enclosed in a try/catch block that catches TestException.