请帮忙看一下
import java.awt.*;class human{
String name;//姓名
int age;
String gender;
public void saysth(String sth){
//......
}
public void eat(Object o){
//......
}
public void kick(Object o){
System.out.println(name+"踢了"+((dog)o).name+"一脚");
}
}
class dog{
String name;
int age;
Color furcolor;
public void bite(Object o){
System.out.println(name+"咬了"+((human)o).name+"--");
}
public void shout(){
System.out.println(name+":汪汪汪");
}
public void run(){
System.out.println(name+"夹着尾巴跑了");
}
}
public class Astory{
public static void main(String[] args){
human human=new human();//形成了一个对象
dog dog=new dog();
human.name="张三";
dog.name="阿黄";
System.out.println("山上住着一个人:名字叫"+human.name);
System.out.println("山下住着一条狗:名字叫"+dog.name);
human.kick(dog);
int i=(int)Math.random()*3;
switch(i){
case 0:dog.bite(human);break;
case 1:dog.shout();break;
case 2:dog.run();
}
}
}
为什么输出的结果一样的,各位帮忙啊!