可学答题网 > 问答 > OCJP(310-065)题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

Given a method that&en


Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()

  • Aassert value == null;
  • Bassert value != null, "value is null";
  • Cif (value == null) { throw new AssertionException("value is null"); }
  • Dif (value == null) { throw new IllegalArgumentException("value is null"); }
参考答案
参考解析:
分类:OCJP(310-065)题库
相关推荐

1、若a=5,b=3,c=4,逻辑表达式!(a+b)&;&;!c的值

若a=5,b=3,c=4,逻辑表达式!(a+b)&;&;!c的值为()A0B-1C1D2

2、Given that a static&en

Given that a static method doIt() in a class Work represents work to be done, what&ensp...

3、现有int a,*b;,b=&a;,则下列运算错误的是

现有int a,*b;,b=&a;,则下列运算错误的是A*&aB&*aC*&bD&*b

4、若有定义语句:double a,+P=&;a;以下叙述中错误的是( )

若有定义语句:double a,+P=&a;以下叙述中错误的是( )。A定义语句中的*号是一个问址运算符B定义语句中的*号是一个说明符C定义语句中的P只能存放double类型变量的地址...

5、Given a method that&en

Given a method that must ensure that its parameter is not null:What, inserted at line 12...

6、试题23若有定义语句:double a, *p=&a; 以下叙述中错

试题23若有定义语句:double a, *p=&a; 以下叙述中错误的是()A定义语句中的*号是一个间址运算符B定义语句中的*号只是一个说明符C定义语句中的p只能存放double类型的变量D定...