为什么我的运行结果会出现ExtendsClass.Dog@15136019这个
public class Anmial {
int age=1;
private int a;
String name ;
public void show(){
System.out.println(this.name+"会吃东西");
}
/*public Anmial(){
System.out.println("父类的无参构造方法执行了");
}*/
public Anmial(int c){
System.out.println("父类的有参构造方法执行了");
}
}
public class Dog extends Anmial {
private int age=10;
public void Get(){
System.out.println("子类属性值"+age+"父类属性值"+super.age);
}
public Dog(){
super(2);
System.out.println("子类的构造方法执行了");
}
}
public class Test01 {
public static void main(String[] args) {
Dog dog = new Dog();
System.out.println(dog);
dog.name="哮天犬";
dog.show();
dog.Get();
}
}