Code
-------------------------------------
class Parent{int i = 10;}
class Child extends Parent{ int k = 12;}
public class Class15 {
public static void main(
String args[]){
Child [] c = new Child[2];
Parent [] p = c;
p[0] = new Parent(); //1
System.out.println("Value : "+p[0].i); //2
}
}
---------------------------------------------------------------
Query 1: Why am I getting Runtime exception at line //2 when I'm reinitiallizing Parent at //1.
Please explain this.