Ad Code

Implement inheritance using Java consider Super class Animal with specific charactristics like eating habits ,specifications color etc.Inherits all properites of super to subclasses (Cat ,Dog,Cow) .Also include mehods to subclasses.

Program-
class Animal{
int a=10;
public void move() {
System.out.println("Animals move");
}
}
class Lion extends Animal{
public void move() {
System.out.println("Lion move");
}
}
class Tiger extends Animal{
public void move() {
System.out.println("Tiger move");
}
}
public class AnimalMove {
public static void main(String[] args) {
Tiger t = new Tiger();
Lion l =new Lion();
t.move();
l.move();
}
}
Reactions

Post a Comment

0 Comments