Java : Super class array object assigned with sub class array object
问题 I'm trying to assign a sub class object array to its super class. The program compiles successfully, but I' getting an ArrayStoreException . I know that arrays parent and child are references to same array, but shouldn't I be able to access method func at least? class Pclass { Pclass() { System.out.println("constructor : Parent class"); } public void func() { System.out.println("Parent class"); } } class Cclass extends Pclass { Cclass() { System.out.println("Constructor : Child class"); }