File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cloning multidimension arrays

 
Shivani Chandna
Ranch Hand
Posts: 380
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
naraharirao mocherla
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 380
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i suppose so that the method is included
Here is Corey's Site

-- Shivani
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic