class Animal
{
static void doStuff()
{
System.out.print("a ");
}
}class Dog extends Animal
{
static void doStuff()
{
System.out.print("d ");
}
public static void main(String [] args)
{
Aniaml [] a = { new Animal(), new Dog(),new Animal() };
for( int x = 0; x <a.length; x++)
a[x].doStuff();
Dog.doStuff();
}}
{
static void doStuff()
{
System.out.print("a ");
}
}class Dog extends Animal
{
static void doStuff()
{
System.out.print("d ");
}
public static void main(String [] args)
{
Aniaml [] a = { new Animal(), new Dog(),new Animal() };
for( int x = 0; x <a.length; x++)
a[x].doStuff();
Dog.doStuff();
}}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货