tom喵八卦
class Animal {
public void sound(){}
}
class Dog extends Animal{
public void sound(){
System.out.print("汪汪");
}
}
class Cat extends Animal{
public void sound(){
System.out.print("喵喵");
}
}
public class Test{
public static void main(String[] args) {
Animal c = new Cat();
Animal d = new Dog();
System.out.print("tom");
c.sound();
System.out.print("旺财");
d.sound();
}
}