How to 'derefence' an object in Java
<pre><code>class DogOwner {
    Dog dog;

    DogOwner(Dog dog) {
        this.dog = dog;
    }
}

class Dog {
    int age;

    Dog(int age) {
        this.age = age;
    }
}

DogOwner peter = new DogOwner(new Dog(2));
Dog max = peter.dog;
max.age = 3;

System.out.println(peter.dog.age); // 3
</code></pre>

<p>How can I retreive <code>max</code> from <code>peter</code> without <code>max</code> being a reference to the <code>Dog</code> owned by <code>peter</code>? In other words, I would like to be able to set <code>max</code>'s age to 3 without <code>peter</code>'s <code>Dog</code> being changed.</p>
