Which of the following can be inserted on line 8 to make this code compile?
Choose all that apply
7: public void r() throws IOException { 8: // INSERT CODE HERE 9: }
Exception()
; IllegalArgumentException()
; IOException()
; RuntimeException()
; A, C, D, E.
A method that declares an exception isn't required to throw one, making option A correct.
Runtime exceptions can be thrown in any method, making options C and E correct.
Option D matches the exception type declared and so is also correct.
Option B is incorrect because a broader exception is not allowed.