Given a method that must ensure that its parameter is not nu

题目
单选题
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); }

参考答案和解析
正确答案: A
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

You are configuring the ERX Edge Router as an LNS in an L2TP network.Which statement is true about the value of the remote host parameter?()

A.It must be the same as the server-name parameter on the LAC

B.It must be the same as the client-name arameteron the LAC

C.It must be the same as the remote-hostname parameter on the LAC

D.It must be the same as the tunnel password parameter on the LAC


参考答案:B

第2题:

What is the name of the method that threads can use to pause their execution until signalled to continue by another thread? () Fill in the name of the method (do not include a parameter list).


正确答案:"wait"

第3题:

You are writing a method that accepts a string parameter named message.Your method must break the message parameter into individual lines of text and pass each line to a second method named Process.Which code segment should you use?()

A.

B.

C.

D.


参考答案:D

第4题:

A batch application executes a large number of update statements. The service level agreement for the application states that the application must complete its work as quickly as possible to ensure that dependent workloads can start ontime. What is one way to help the application complete quickly?()

  • A、Code the application to issue a LOCK TABLE statement.  
  • B、Code the application to issue a LOCK ROW statement.  
  • C、Decrease the number of I/O servers.  
  • D、Increase the locklist parameter. 

正确答案:A

第5题:

Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()

  • A、The foo initialization parameter CANNOT be set programmatically.
  • B、Compilation fails because getInitParameter returns type Object.
  • C、The foo initialization parameter is NOT a servlet initialization parameter.
  • D、Compilation fails because ServletContext does NOT have a getInitParameter method.
  • E、The foo parameter must be defined within the  element of the deployment descriptor.

正确答案:A,C

第6题:

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.

正确答案:C,E

第7题:

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 TLD
  • D、 The do Start Tag Method must always return SKIP_BODY.
  • E、 The TLD for this tag must NOT include a  tag.

正确答案:C

第8题:

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.


参考答案:B

第9题:

You are configuring the ERX Edge Router as an LNS in an L2TP network.Which statement is true about the value of the remote host parameter?()

  • A、It must be the same as the server-name parameter on the LAC
  • B、It must be the same as the client-name arameteron the LAC
  • C、It must be the same as the remote-hostname parameter on the LAC
  • D、It must be the same as the tunnel password parameter on the LAC

正确答案:B

第10题:

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.

正确答案:E,F

更多相关问题