Java 16 - multi level inheritance
Sun Nov 26 2023 17:03:31 GMT+0000 (Coordinated Universal Time)
Saved by
@Java
class Animal
{
void eat()
{
System.out.println("eaƟng...");
}
}
class Dog extends Animal
{
void bark()
{
System.out.println("barking...");
}
}
Class BabyDog extends Dog
{
void weep()
{
System.out.println("weeping...");
}
}
public class LabTask16
{
public staƟc void main(String args[])
{
BabyDog d=new BabyDog();
d.weep();
d.bark();
d.eat();
}
}
content_copyCOPY
Comments