/* WhiteMouseFamily.java example code AC Chapin */ package mouses; // demonstrate use of reference type instance variables public class WhiteMouseFamily { /** * main creates 3 WhiteMouse objects, * makes two of them parents of third * @param args */ public static void main(String[] args) { // make mice WhiteMouse ozzie = new WhiteMouse(); ozzie.idNum= 44038; ozzie.age = 63; WhiteMouse harriet = new WhiteMouse(); harriet.idNum= 66902; harriet.age = 78; WhiteMouse spike = new WhiteMouse(); spike.idNum= 49890; spike.age = 12; // family relations spike.mother = harriet; spike.father = ozzie; // this method uses the mother and father variables spike.exposeTo("Glycerin"); // accessing objects indirectly to set values spike.mother.age = 79; // affects harriet spike.father.idNum= 44037; // affects ozzie // accessing objects indirectly to call methods spike.father.exposeTo("Propylene Glycol"); spike.mother.exposeTo("Isopropyl Myristate"); } }