Hi all,
I hope things are going well; I have a question about the toArray() method from the ArrayList class. I am re-reading Gupta's excellent OCAJP7 study-guide and am confused by the two paragraphs at the top of page 221. These paragraphs seem to be trying to explain how modifying either 1) the elements of the returned array from the toArray() method call or 2) modifying the ArrayList that generated the array could effect the original ArrayList data structure or the array or something.... 0_o
I tried this in this program and it only modified the ArrayList I intentionally modified and did not affect the array created from the ArrayList
In the code above only the ArrayList is changed even though StringBuilder is a completely changeable, i.e. mutable, object.
Can someone explain a situation where changing one collection would affect the other please? I did search the site before asking.
Also, are there many questions on the exam that have this method in them?
Thank-you for reading.
Party On,
Ted