Which of the following can be inserted into Lion to make this code compile?
Choose all that apply
class Ex1 extends Exception {} class Ex2 extends RuntimeException {} interface Roar { void roar() throws Ex1; } class Lion implements Roar {// INSERT CODE HERE }
roar()
{} roar()
throws Exception{} roar()
throws Ex1{} roar()
throws IllegalArgumentException{} roar()
throws Ex2{} A, C, D, E.
The method is allowed to throw no exceptions at all, making option A correct.
It is also allowed to throw runtime exceptions, making options D and E correct.
Option C is also correct since it matches the signature in the interface.