aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "collections " Watch "collections " New topic
Author

collections

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
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).]


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: collections