abstract class Animal{ static String zl; static String js; abstract void shout();} class Cat extends Animal{ Cat(String cat){ zl=cat; } void shout() { String cc="喵喵"; js=cc; System.out.println("种类"+zl+",叫声"+js); } } class Dog extends Animal{ Dog(String dog){ zl=dog; } void shout() { String dd="汪汪"; js=dd; System.out.println("种类"+zl+",叫声"+js); } }class we{ public static void main(String[] args) { Cat t1=new Cat("猫"); t1.shout(); Dog t2=new Dog("狗"); t2.shout(); }}
添加回答
举报
0/150
提交
取消