KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an object that I need to copy in Java. I need to create a copy and run some tests on it without changing the original object itself. I assumed that I needed to use the clone() method, but this is protected. Having done some research on the net, I can see that this can be overriden with a public method in my class. But I cannot find an explanation on how to do this. How could this be done? Also, is this the best way of achieving what I need?
Tags (comma-separated)
Save Edits
Cancel