File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

Collection

Shiva Mohan
Ranch Hand

Joined: Jan 05, 2006
Posts: 477
javabeat question

Given two collection objects referenced by c1 and c2, which of these statements are true?

Select 2 correct options

(1) c1.retainAll(c2) will not modify c1
(2) c1.removeAll(c2) will not modify c1
(3) c1.addAll(c2) will return a new collection object, containing elements from both c1 and c2
(4) For: c2.retainAll(c1); c1.containsAll(c2); 2nd statement will return true
(5) For: c2.addAll(c1); c1.retainAll(c2); 2nd statement will have no practical effect on c1

the given answers are 4 and 5? I am not sure all this options in coding way? Please help me to start working on this?Any ideas?
Prasad Shindikar
Ranch Hand

Joined: Feb 18, 2007
Posts: 114
hi sirishaaaa,

whenever we say b2[1][1] = something ;
what the compiler really expects is a 2d-array
so when we say b2[1][1] = b;
we are actually passing a 2d-array reference
the dimensions of the array to which this reference points does not matter
Prasad Shindikar
Ranch Hand

Joined: Feb 18, 2007
Posts: 114
sorry
posted the answer in the wrong topic
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Nope, you posted in what you thought was the right topic. There's something strange about this particular thread - probably caused by a UBB software bug.

Closing as a duplicate.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collection