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?()A、assert value == null;B、assert value != null, "value is null";C、if (value == null) { throw new AssertionException("value is null"); }D、if (value == null) { throw new IllegalArgumentException("value is null"); }

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?()

  • A、assert value == null;
  • B、assert value != null, "value is null";
  • C、if (value == null) { throw new AssertionException("value is null"); }
  • D、if (value == null) { throw new IllegalArgumentException("value is null"); }

相关考题:

public class Test{2.int x=12;3.public void method(intx){4.x+=x;5.System.out.println(x);6.}7.}Given:34.Test t=new Test();35.t.method(5);What is the output from line 5 of the Test class?() A.5B.10C.12D.17E.24

Given:What is the result when the go() method is invoked?() A.00B.0001C.000120D.00012021E.Compilation fails.F.An exception is thrown at runtime.

Given:What is the result when method testIfA is invoked?() A.TrueB.Not trueC.An exception is thrown at runtime.D.Compilation fails because of an error at line 12.E.Compilation fails because of an error at line 19.

Click the Exhibit button. Given:Which statement is true if a TestException is thrown on line 3 of class B? () A.Line 33 must be called within a try block.B.The exception thrown by method1 in class A is not required to be caught.C.The method declared on line 31 must be declared to throw a RuntimeException.D.On line 5 of class A, the call to method2 of class B does not need to be placed in a try/catch block.

Given:Which two can be results?() A. java.lang.RuntimeException: ProblemB. run.java.lang.RuntimeException: ProblemC. End of method.java.lang.RuntimeException: ProblemD. End of method.run.java.lang.RuntimeException: ProblemE. run.java.lang.RuntimeException: Problem End of method.

T/T is a quicker method of payment than a banker’s demand draft.A对B错

Which two statements are true about the hashCode method?()A、 The hashCode method for a given class can be used to test for object equality and object inequality for that class.B、 The hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.C、 The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.D、 The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.E、 The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

Given: 6. 7.%="processing" % 8. and a custom tag handler for foo which extends TagSupport. Which two are true about thetag handler referenced by foo?()A、The doStartTag method is called once.B、The doAfterBody method is NOT called.C、The EVAL_PAGE constant is a valid return value for the doEndTag method.D、The SKIP_PAGE constant is a valid return value for the doStartTag method.E、The EVAL_BODY_BUFFERED constant is a valid return value for the doStartTag method.

1. public class Test {  2. int x= 12;  3. public void method(int x) {  4. x+=x;  5. System.out.println(x);  6. }  7. }  Given:  34. Test t = new Test();  35. t.method(5);  What is the output from line 5 of the Test class?() A、 5B、 10C、 12D、 17E、 24

Given the ActionEvent, which method allows you to identify the affected component?()A、 GetClass.B、 GetTarget.C、 GetSource.D、 GetComponent.E、 GetTargetComponent.

Given an EL function declared with:11.  12.spin 13.com.example.Spinner 14. 15.java.lang.String spinIt() 16. 17. Which two are true?()A、The function method must have the signature: public String spin().B、The method must be mapped to the logical name "spin" in the web.xml file.C、The function method must have the signature: public String spinIt().D、The function method must have the signature public static String spin().E、The function method must have the signature: public static String spinIt().F、The function class must be named Spinner, and must be in the package com.example.

Given the following six method names: add Listener add Mouse Listener set Mouse Listener delete Mouse Listener remove Mouse Listener register Mouse Listener How many of these method names follow JavaBean Listener naming rules?()A、1B、2C、3D、4

Given that t1 is a reference to a live thread, which is true?()A、The Thread.sleep() method can take t1 as an argument.B、The Object.notify() method can take t1 as an argument.C、The Thread.yield() method can take t1 as an argument.D、The Thread.setPriority() method can take t1 as an argument.E、The Object.notify() method arbitrarily chooses which thread to notify.

Which statement is true?()A、A class’s finalize() method CANNOT be invoked explicitly.B、super.finalize() is called implicitly by any overriding finalize() method.C、The finalize() method for a given object is called no more than once by the garbage collector.D、The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable.

单选题Given the ActionEvent, which method allows you to identify the affected component?()A GetClass.B GetTarget.C GetSource.D GetComponent.E GetTargetComponent.

多选题Which two are true?()AA finalizer may NOT be invoked explicitly.BThe finalize method declared in class Object takes no action.Csuper.finalize()is called implicitly by any over riding finalize method.DThe finalize method for a given objec twill be called no more than once by the garbage collector.EThe order in which finalize will be called on two objects is based on the order in which the two objects became finalizable.

单选题Given that t1 is a reference to a live thread, which is true?()AThe Thread.sleep() method can take t1 as an argument.BThe Object.notify() method can take t1 as an argument.CThe Thread.yield() method can take t1 as an argument.DThe Thread.setPriority() method can take t1 as an argument.EThe Object.notify() method arbitrarily chooses which thread to notify.

单选题1. public class Test {  2. int x= 12;  3. public void method(int x) {  4. x+=x;  5. System.out.println(x);  6. }  7. }  Given:  34. Test t = new Test();  35. t.method(5);  What is the output from line 5 of the Test class?()A 5B 10C 12D 17E 24

单选题Which statement is true?()AA class’s finalize() method CANNOT be invoked explicitly.Bsuper.finalize() is called implicitly by any overriding finalize() method.CThe finalize() method for a given object is called no more than once by the garbage collector.DThe order in which finalize() is called on two objects is based on the order in which the two objects became finalizable.

单选题Given the Tag:   Assuming the tag referenced by my Tags: get Advice uses the Classic event model,  which is true?()A The do After Body method is called.B The doEnd Tag method is NOT called.C The type attribute may be specified in the TLDD The do Start Tag Method must always return SKIP_BODY.E The TLD for this tag must NOT include a  tag.

单选题Given the following six method names:(1)addListener(2)addMouseListener (3)setMouseListener(4)deleteMouseListener(5)removeMouseListener(6)registerMouseListenerHow many of these method names follow JavaBean Listener naming rules?()A1B2C3D4E5

单选题Given: What is the result when the go( ) method is invoked?()A 00B 0001C 000120D 00012021E Compilation fails.F An exception is thrown at runtime.

单选题1.public class Test{ 2.int x=12; 3.public void method(intx){ 4.x+=x; 5.System.out.println(x); 6.} 7.} Given: 34.Test t=new Test(); 35.t.method(5); What is the output from line 5 of the Test class?()A5B10C12D17E24

多选题Which two statements are true about the hashCode method?()AThe hashCode method for a given class can be used to test for object equality and object inequality for that class.BThe hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.CThe hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.DThe only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.EThe hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

单选题Given the following six method names: add Listener add Mouse Listener set Mouse Listener delete Mouse Listener remove Mouse Listener register Mouse Listener How many of these method names follow JavaBean Listener naming rules?()A1B2C3D4

多选题Given an EL function declared with:11.  12.spin 13.com.example.Spinner 14. 15.java.lang.String spinIt() 16. 17. Which two are true?()AThe function method must have the signature: public String spin().BThe method must be mapped to the logical name spin in the web.xml file.CThe function method must have the signature: public String spinIt().DThe function method must have the signature public static String spin().EThe function method must have the signature: public static String spinIt().FThe function class must be named Spinner, and must be in the package com.example.

多选题Given: 6. 7. 8. and a custom tag handler for foo which extends TagSupport. Which two are true about thetag handler referenced by foo?()AThe doStartTag method is called once.BThe doAfterBody method is NOT called.CThe EVAL_PAGE constant is a valid return value for the doEndTag method.DThe SKIP_PAGE constant is a valid return value for the doStartTag method.EThe EVAL_BODY_BUFFERED constant is a valid return value for the doStartTag method.

多选题Given a pre-generics implementation of a method: What three changes allow the class to be used with generics and avoid an unchecked warning?()ARemove line 14.BReplace line 14 with "int i = iter.next();".CReplace line 13 with "for (int i : intList) {".DReplace line 13 with "for (Iterator iter : intList) {".EReplace the method declaration with "sum(List  intList)".