| Author |
Cloning multidimension arrays
|
Shivani Chandna
Ranch Hand
Joined: Sep 18, 2004
Posts: 380
|
|
Cloning multidimension arrays results in shallow cloning. Have understood that from below exampls. Can someone explain using diagram - (like Corey explained the GC concepts on this site...) as to how the shallow copying is working Produces the following output: false I2:79 I3:3 false I22:79 I33:79 Thanks a lot !
|
/** Code speaks louder than words */
|
 |
Michael Ernest
High Plains Drifter
Sheriff
Joined: Oct 25, 2000
Posts: 7292
|
|
I don't understand your example. You clone() I2, then test for equality of reference between I2 and I3, which is going to be false. Then you change the value of I2[0] and print it. Then you print out I3[0]. What are you trying to demonstrate?
|
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
|
 |
naraharirao mocherla
Ranch Hand
Joined: Aug 16, 2005
Posts: 45
|
|
Hi Shivani can you please give me Corey's link you mentioned(regarding GC diagrams). Thanks in advance. 1.Is clone method() included in SCJP 1.4 ?
|
 |
Shivani Chandna
Ranch Hand
Joined: Sep 18, 2004
Posts: 380
|
|
yes i suppose so that the method is included Here is Corey's Site -- Shivani
|
 |
 |
|
|
subject: Cloning multidimension arrays
|
|
|