/* Author: James Tam Version: January 27, 2021 Learning objective: distinguishing between shallow vs. deep copies. 1) The first copies the contents of the reference (address of an array or object). 2) The second copies data which is what the reference refers to (object state or contents of an array). */ public class Driver { public static void main(String [] args) { Person mary = new Person(21); Person bob = new Person(12); System.out.println(mary.age + " " + bob.age); mary = bob; // Shallow; bob.age = 66; System.out.println(mary.age + " " + bob.age); bob = new Person(77); mary.age = bob.age; // Deep bob.age = 144; System.out.println(mary.age + " " + bob.age); } }