I tried to clone an object and change member functions of new clonned object. If it is shallow copy and according to wiki page, shallow copy and original object point to sam
why do you think clone is a shallow copy? see here: http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#clone()
As it says - what clone does is implementation dependent. Also a 'shallow copy' doesn't simply create a new reference to the same object - generally it means that a new instance is created with the same internal members as the object copied-from. But if you change a member variable of the new obj to point to something new, you are not changing member vars of original obj.