Advice on Cloneable / clone()
Hi,
I'm trying to pop an object from a stack and clone it without knowing
anything more about its type than the object implementing interface
Cloneable:
// S is a stack
Object o1 = S.peek();
Object o2 = ((Clonable) o1).clone();
Yet somehow, this does not work. Does anybody know why?
Thanks so much,
Stef
|