How to clone an Object you dont know the type of?
问题 its easier to explain in code so here Object anObj; anObj = new MyObj(); anObj = new Rectangle(); anObj.clone();//this doesnt exist because its on the root Object class what can i use instead of the Object.clone() method in this example? ----------------------- extra info ------------------------------ I have added extra info but it seems to have gone in the middle of all the answers, so here it is again so it can be read. Hi all these are all really helpful on topic of cloning or copying,