请高手回答 填空题
class Cat{
int age;
int weight;
void meow()
{
System.out.println("Meow.......");
}
}
class Dog
{
int age;
int weight;
Dog()
{
age=2;
weight=4;
}
Dog(int a,int w)
{
age=a;
weight=w;
}
void wang()
{
System.out.println("wang.......");
}
}
class Num
{
int i;——————
}
public class Test
{
public static void main(String []args)
{
Cat cat1=new Cat();
Cat cat2=new Cat();
Dog dog1=new Dog();
Dog dog2=new Dog(3,5);
Num num1=new Num();
Num num2=new Num();
num1.i=1;num2.i=2;
System.out.println("num1.i="+num1.i+" num2.i="+num2.i);
____________________ ______________
num2=num1;
num2.i=9;
System.out.println("num1.i="+num1.i+" num2.i="+num2.i);
_____________________ ______________________
System.out.println("cat1.age="+cat1.age+" cat2.age="+cat2.age);
_______________________ ______________
System.out.println("cat1.weight="+cat1.weight+" cat2.weight="+cat2.weight);
__________________ _____________
System.out.print("cat1.meow:");
cat1.meow();
System.out.print("cat2.meow:");
cat2.meow();
System.out.println("dog1.age="+dog1.age+" dog2.age="+dog2.age);
________________ ________________
System.out.println("dog1.weight="+dog1.weight+" dog2.weight="+dog2.weight);
_________________ ___________________
System.out.print("dog1.wang :");
dog1.wang();
__________________
System.out.print("dog2.wang :");
dog2.wang();
_____________________
}
}
class Animal
{
public void speak()
{
System.out.println("Animal speak...");
}
}
class Dog extends Animal
{
public void speak()
{
System.out.println("Bowwow...");
}
}
class Cat extends Animal
{
public void speak()
{
System.out.println("Meow...");
}
}
public class TestPolymorphism
{
public static void makeSpeak(Animal a)
{
a.speak();
}
public static void main(String[] args)
{
Cat c=new Cat();
Dog d=new Dog();
makeSpeak(c);
_______________________
makeSpeak(d);
_____________
}
}