public class SuperClass{
class SubClassA extends SuperClass{}
class SubClassB extends SuperClass{}
public void
test(SubClassA foo){
SuperClass bar=foo;
}
}
which statement is true about the assignment in line 5?
A. The assignment in line 5 is illegal
B. The assignment in line 5 is legal, but throw a ClassCastException
C. legal and will always executes without throw an Exception
Which answer is correct?
Who can explain and give an example to run this code?
Thanks a lot
[ February 17, 2003: Message edited by: frank yang ]