class Animal {
public String name;

Animal(String name) {
this.name = name;
}
}class Dog extends Animal {
public String furcolor;

Dog(String n, String furcolor) {
super(n);
this.furcolor = furcolor;
}
}class Cat extends Animal {
public String eyescolor;
Cat(String n, String eyescolor) {
super(n);
this.eyescolor = eyescolor;
}
}public class Test6 {
public static void main(String[] args) {
Test6  t6 = new Test6();
Animal a = new Animal("name1");
Dog d = new Dog("dogname","redfur");
Cat c = new Cat("catname","blueeyes");
t6.t(a); t6.t(d); t6.t(c);

public void t(Animal b) {
System.out.println("name :"+a.name);
if(a instanceof Dog) {
Dog dog = (Dog)a;
System.out.println("furcolor"+dog.furcolor);
}
else if (a instanceof Cat) {
Cat cat = (Cat)a;
System.out.println("eyescolor"+cat.eyescolor);
}
}
}
}这是练习的小程序,编译的时候告诉我public void t(Animal b)是非法表达式的开始,
Test6.java:34: 非法的表达式开始
                public void t(Animal b) {
                ^
Test6.java:34: 非法的表达式开始
                public void t(Animal b) {
                       ^
Test6.java:34: 需要 ';'
                public void t(Animal b) {
                             ^
Test6.java:34: 需要 ';'
                public void t(Animal b) {
请问哪里错了呢?