電話する方法は?実行する方法?
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)「黒」の呼び方は?