题目
题目

XLMC0202501 Topic 6 Quiz

单项选择题

Consider the following code snippet: // suppose T1 is a LinkedList<Integer> that currently // stores 5 elements. LinkedList<Integer> T2 = T1.clone(); T2.insertLast(42); T2.clear(); // Remove all elements from T2. Suppose the clone() method for LinkedList is a shallow clone.   After the above code is executed, how many elements are in the list T1?  

选项
A.6
B.7
C.5
D.4
查看解析

查看解析

标准答案
Please login to view
思路分析
To tackle this, start by restating the situation and the operations performed on copies of the list. Option analysis begins with the initial condition: T1 is a LinkedList<Integer> that currently stores 5 elements. 1) Option: 6 This would imply that cloning T1 somehow increases the size of T1 after the subsequent operations. However, cloning cr......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!