System.out.println(dog); 是不是相当于 dog.toString();
不是,这两个才是一样的!前提是你必须在Animal中重写了toString方法!
System.out.println(dog.toString());
System.out.println(dog);