Originally posted by gouru:
are any body good in collections,can u help me.
Given two collection objects referenced by col1 and col2, which of these statements are true? (multiple answers)
a) the operation c1.retainALL(col2) does not modify the col1 object
b) the operation c1.removeAll(col2) will not modify the col2 object
c)the operation c1.addAll(col2) will return collection object
containing elements from both col1 and col2
d) the operation c1.containsAll(col2) will not modify the col1 object
please tell me correct answers. i am not sure of collections.
thank u
a - false - c1 is modified to only have the elements that are common in both.
b - true - col2 is never modified only used as the comparasion to c1 note: c1 is modified to only have the elements that are not in col2.
c - false - the return of the method is boolean, c1 is modified to contain all the elements of c1 and c2
d - true - containsAll returns a boolean result if c1 contains all the elements in c2 but, doesn't modify the c1 object.
[This message has been edited by Carl Trusiak (edited June 21, 2000).]