chaitanya karthikk wrote:But anyhow, regardless of calling super.clone() or returning a new object, both times a new instance is created for the object. What is the difference exactly?
When you create a new instance, the values of its fields will be set to the "defaults." When you clone an object, the values of its fields should be set to the value of the original object. So:
using new: create a brand new object with default field values
using clone(): create a brand new object and set its field values to match the original
(I agree with tracking down Bloch's
Effective Java. It's an excellent book. Note, however, that
Effective Java assumes you're familiar and comfortable with the basics. It's not an introductory text.)