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

Aru
Ranch Hand

Joined: Jul 20, 2000
Posts: 112

Hi,
Can anyone help me out with this ?
Which of these methods from the Collection interface return the value true if the collection object was actually modified by the call?
a. add()
b. retainAll()
c. containsAll()
d. contains()
e. remove()

Thx in advance.
Aruna
chetan nain
Ranch Hand

Joined: Jun 21, 2000
Posts: 159
answer: add(), retain(), retainAll(), and remove()
although contains() and containsAll() also return a boolean value, the point to remember here is that the question asks for methods that return true AFTER modification
HTH
chetan
Ada Wang
Greenhorn

Joined: Aug 28, 2000
Posts: 23
add() - Returns true if this collection changed as a result of the call.
retainAll() - Return true if this collection changed as a result of the call
contains() - Returns true if this collection contains the specified element
containsAll() - Returns true if this collection contains all of the elements in the specified collection.
remove() - Returns true if this collection changed as a result of the call
Ada
Ada Wang
Greenhorn

Joined: Aug 28, 2000
Posts: 23
The answer should be ABE.
Karthik Subramanian
Greenhorn

Joined: Aug 23, 2000
Posts: 27

I agree with wang.The answer is a,b,e
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
a and e
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collections