This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clone() method

 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I read cloneable interface is tagging interface. Class must override Clone() metjod declaring it as public where as Clone() method declared as protected in Object class. Any ideas, suggestions, links, resources, sample code highly appreciated. Thanks in advance
 
Stephan van Hulst
Bartender
Pie
Posts: 5414
52
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you should ask more specific questions. Is there anything you don't understand?

The clone() method is very tricky. It's useful to know how it works, but you shouldn't be eager to put it to use. It breaks easily.
 
Campbell Ritchie
Sheriff
Posts: 48440
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Effective Java™ by Joshua Bloch, page 54.
You may be able to find a sample chapter from the first edition free of charge on the net; that covers clone().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic