class Animal
{ {System.out.println("Animal");}
}
class Dog extends Animal
{ {System.out.println("Dog");}
}
class DogKid extends Dog
{ {System.out.println("DogKid");}
}
class ArrayInFamily
{
static void m1()
{
Animal[] a=new Animal[3];
{ a[0] = new Animal();
a[2] = new DogKid();
for(Animal aa:a )
{
System.out.println(aa);
}
}
}
public static void main(String[] args)
{
m1();
}
}
Thanks
Happy programming!
{ {System.out.println("Animal");}
}
class Dog extends Animal
{ {System.out.println("Dog");}
}
class DogKid extends Dog
{ {System.out.println("DogKid");}
}
class ArrayInFamily
{
static void m1()
{
Animal[] a=new Animal[3];
{ a[0] = new Animal();
a[2] = new DogKid();
for(Animal aa:a )
{
System.out.println(aa);
}
}
}
public static void main(String[] args)
{
m1();
}
}
Thanks
Happy programming!
No comments:
Post a Comment