Question: 1. class TestException extends Exception ( 2. class A 3. public String sayHello(String name) throws TestException { 4. ifname nul throw new TestExceptiono: 5. return

1. class TestException extends Exception ( 2. class A 3. public String sayHello(String name) throws TestException { 4. ifname nul throw new TestExceptiono: 5. return "Hello"name; 6 7 8. public class TestA ( 9. public static void main(StringI args) 10. new A().sayHello( Aiko") 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 tryicatch block that catches TestException
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
