今天在翻Core Java的时候,看这样一段话
In Java, arrays of subclass references can be converted to arrays of superclass references without a cast. For example, consider this array of managers:
Manager[] managers = new Manager[10];
It is legal to convert this array to an Employee[] array:
Employee[] staff = managers; // OK
Sure, why not, you may think. After all, if managers[i] is a Manager, it is also an Employee. But actually, something surprising is going on. Keep in mind that managers and staff are references to the same array. Now consider the statement
staff[0] = new Empl