5. Passing a Copied Value in and out of methods.

Listing 5. Passing a Copied Value in and out of methods.


class Order
{
    ...
    public void setDeliveryDate(Date newDeliveryDate)
        { deliveryDate = (Date) newDeliveryDate.clone(); }
    public Date getDeliveryDate()
        { return (Date) deliveryDate.clone(); }
    private Date deliveryDate;
}

About the Author

Kevlin Henney is a Principal Technologist with QA Training in the UK.

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.