Dear Amy,

Season's Greetings!

Dear Bob,

Love and Kisses,


Dear Cindy,

Happy 17th Birthday

Holding References but not Using them

What types of objects a reference variable can refer to:

A variable can hold a reference to an object whose class is a descendant of the class of the variable.

The class of the object must be a descendant of the class of the variable that holds a reference to that object. A descendant of a class is a child of that class, or a child of a child of that class, and so on. Siblings are not descendants of each other (you did not inherit anything from your brother, thank goodness.)

Note: there are some complications to this rule which are skipped in these notes, since you will probably never need to know them. Here are some variable declarations:

Card      c;
Birthday  b;
Valentine v;
Holiday   h


Which of the following are correct?

c = new Valentine("Debby", 8);
b = new Valentine("Elroy", 3);
v = new Valentine("Fiona", 3);
h = new Birthday ("Greg",  35);