Given a method that must ensure that its parameter is not null:<br /> 11. public void someMethod(Object value) {<br /> 12. // check for null value<br /> ...<br /> 20. System.out.println(value.getClass());<br /> 21. }<br /> What inserted at line 12, is the appropriate way to handle a null value?()<p> Given a method that must ensure that its parameter is not null:<br /> 11. public void someMethod(Object value) {<br /> 12. // check for null value<br /> ...<br /> 20. System.out.println(value.getClass());<br /> 21. }<br /> What inserted at line 12, is the appropriate way to handle a null value?()</p>
A、A.assert value == null;
B、B.assert value != null, "value is null";
C、C.if (value == null) { throw new AssertionException("value is null"); }
D、D.if (value == null) { throw new IllegalArgumentException("value is null"); }