单项选择题X 纠错

A. add this code after line 11: list = (List) list;
B. change lines 12 and 13 to: list.add(”foo”); list.add(”bar”);
C. change the method signature on line 11 to: public void addStrings(List< extends String> list) {
D. change the method signature on line 11 to: public void addStrings(List< super String> list) {
E. No changes are necessary. This method compiles without warnings.

参考答案:
查答案就用赞题库小程序 还有拍照搜题 语音搜题 快来试试吧
无需下载 立即使用

你可能喜欢

多项选择题

A. String s = strings.get(0);
B. Iterator i1 = strings.iterator();
C. String[] array1 = strings.toArray();
D. Iterator i2 = strings.iterator();
E. String[] array2 = strings.toArray(new String[1]);
F. Iterator i3 = strings.iterator();

多项选择题

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.

单项选择题

A. The equals method does NOT properly override the Object.equals method.
B. Compilation fails because the private attribute p.name cannot be accessed in line 5.
C. To work correctly with hash-based data structures, this class must also implement the hashCode method.
D. When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.

单项选择题

A. Compilation fails because the hashCode method is not overridden.
B. A HashSet could contain multiple Person objects with the same name.
C. All Person objects will have the same hash code because the hashCode method is not overridden.
D. If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.

赞题库

赞题库-搜题找答案

(已有500万+用户使用)


  • 历年真题

  • 章节练习

  • 每日一练

  • 高频考题

  • 错题收藏

  • 在线模考

  • 提分密卷

  • 模拟试题

无需下载 立即使用

版权所有©考试资料网(ppkao.com)All Rights Reserved