Hi,
interface I1 {} interface I2 {}
class Base implements I1 {}
class Sub extends Base implements I2 {}
class Silver {
public static void main(
String []args) {
Base[] base = {new Base()};
Sub sub[] = new Sub[1]; // 1
Object obj = base; // 2
sub = (Sub[])obj; // 3
I1 []i1 = (I1[])obj; // 4
}}
The answer is that,there is a runtime error at line 3(This I understood)
BUT.....why there is no runtime error at line 4.
Can anybody please explain me......
Thanks.