Inheritance and casting in Java
问题 I have a question about inheritance and casting in Java. I have the following two example classes and a test class, and I state my question after the classes: public class Automobile { public int var; public Automobile () { var = 1; } public String toString () { return "AUTOMOBILE: " + var; } } public class Porsche extends Automobile { public int var; public Porsche () { var = 2; } public String toString () { return "PORSCHE: " + var; } } public class Test { public static void main (String []