In the example below (from my coursepack), we want to give to the Square instance c1 the reference of some other object p1, but only i
Square
c1
p1
There's a difference between measuring if some object will fit in a box, and actually putting it in the box. instanceof is the former, and casting is the latter.
instanceof