posted 24 years ago
Hi gunjan
remember two main facts abt casting
1.At compile time,it will check if the two objects can denote an object of a class,where this class is subtype of both source and destination.
Otherwise it will give compile time error.
2.if it compiles then at run time it will check for the cast.
suppose the cast is
(abc)dest
if dest instanceof abc returns true,then it is a valid cast otherwise it will give class cast exception.