posted 3 days ago
I don't quote understand what you are trying to do, but I don't think that is how you make a copy constructor. The whole idea is to make two different objects with the same state, but whose state may now change independently of each other.
Don't assign fields to null at declaration time, and make the class final.Declare that field final, and you now have an immutable class with all its advantages, including the fact that you never need to take copies of it.Now, let's imagine your book class is no longer immutable. Let's add a field which will have to change from time to time.Now it is worth creating a copy constructor so you can have an object preserving the old price:-[