编写并运行下面的程序,写出运行结果,体会子类是如何继承父类的: class Animal { String name; void shout() { System.out.println("动物发出叫声"); } } class Dog extends Animal { // 定义一个打印name的方法 public void printName() { System.out.println("name=" + name); } } public class Example01 { public static void main(String[] args) { Dog dog = new Dog(); dog.name = "沙皮狗"; dog.printName(); dog.shout(); } }