/* * Car.java 1.0 * * Example for OOP * */ class Car { private Person owner; private String type; public Car(Person owner, String type){ this.owner = owner; this.type = type; owner.setCar(this); } public String toString(){ return type; } public void setOwner(Person newOwner){ owner.setCar(null); owner = newOwner; newOwner.setCar(this); } public Person getOwner(){ return owner; } }