This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I was doing some exercise as part of self learning to implement different sort algorithm and as an additional test, wanted to experiment with deep cloning as well. however the deep cloning is not working in the intended way. may be I am missing something obvious but am not able to get it and hence need some advice. here is the code
and here is the output
before sorting the array is -
after sorting the array is -
Also, your clone() method isn't written quite well. You shouldn't use new to create clones, or sub classes cannot override clone() well. I suggest you change it to this, also keeping the CloneNotSupportedException local to the clone() method: