Which of the following can fill in the blank in this code to make it compile? (Select 2 options.)

public void method() ˍˍˍˍ Exception{
    ˍˍˍˍˍ Exception();
}

A. On line 1, fill in throws
B. On line 1, fill in throws new
C. On line 2, fill in throw new
D. On line 2, fill in throws
E. On line 2, fill in throws new

题解

要让方法将例外往外抛出,需使用「throws」关键字。要抛出一个新的例外,需使用「throw」关键字。要实体化出一个例外,需使用「new」操作符。