怎么打电话?怎么做?
public class Test {
public static void main(String[] args) {
Test test = new Test();
Animal a = new Animal("Animal");
Dog d = new Dog(" BigDog ","yellow");
Cat c = new Cat(" SmallCat ","black");
test.f(a); test.f(d); test.f(c); //(1)
}
public void f(Animal a) {
System.out.println("name :"+ a.name);
if(a instanceof Dog) {
Dog dog = (Dog)a;
System.out.println(" "+ fursColor + "fur"); //!(2)!Error
}
else if(a instanceof Cat) {
Cat cat = (Cat)a;
System.out.println(" " + eyesColor + "eye"); //(3)!Error
}
}
}
问问题:
(1) 这是什么意思?
(2)“黄”怎么称呼?
(3)如何称呼“黑”?