PPT Slide
// Assume we have vector v and int k.
// Assume int k is an index within the// range [0..(v.size( ) - 1)].
o = v.elementAt(k); // no cast needed, already Object
if (o instanceof Student)
if (o instanceof Cafeteria)
// do stuff for Cafeteria
This example is legal Java, but is it good programming?