下面语句中不存在语法错误的选项是( )。
A: throw new NullPointerException();
B: throw “Exception”;
C: throw new Exception();
D: throw new IOException();
A: throw new NullPointerException();
B: throw “Exception”;
C: throw new Exception();
D: throw new IOException();
举一反三
- 下列代码中给出正确的在方法体内抛出异常的是( )。 A: new throw Exception(" "); B: throw new Exception(" "); C: throws IOException(); D: throws IOException;
- 下面的代码: class E1 extends Exception{ }; class E2 extends E1{ } public class Quiz6_3 { public void f(Boolean flag) throws E1{ //一一X一一 } } 下列的语句,哪—个可以放到--X--位置,而且保证编译成功? A: throw new Exception(); B: throw new E1(); C: throw new E2(); D: throw new Error();
- 检查下面的代码: class E1 extends Exception{ }; class E2 extends E1{ } public class Quiz6_3 { public void f(Boolean flag) throws E1{ //一一X一一 } } 下列的语句,哪—个可以放到//--X--位置,而且保证编译成功。 A: throw new Exception(); B: throw new E1(); C: throw new E2(); D: throw new object();
- 能在方法体内正确抛出异常的语句是: A: new throw Exception(",,,,,,"); B: throw newException(",,,,,,"); C: throws newException(",,,,,,"); D: thrownewException;
- 智慧职教: 现有: 1. class Birds { 2. public static void main (String [] args) { 3. try { 4. throw new Exception () ; 5. } catch (Exception e) { 6. try { 7. throw new Exception () ; 8. } catch (Exceptio