This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Diffarence between shallow copy and deep copy

 
sarma kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can any one tell me what is the diffarence between Shallow copy and Deep copy with examples.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
 
Praveen Kumar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shallow copy object and original objects share the member variables.
Object's clone method will do shallow copy.

Where as in deep copy deep copy object and original object will its own member variables. We can get this one by seralisation.
 
James Ryder
Greenhorn
Posts: 5
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Thanks Raj for this awesome reference. I was also looking for a good reference to difference between shallow copy and deep copy. But I felt your post a bit older.
meanwhile I found this one from Marcus Biel.
I liked the way he explained.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic