abstract class Animal {
Animal() {
System.out.println("You are creating an animal");
}
public abstract void walk() {}
public void eat() {
System.out.println("animals eat");
}
}
class Horse extends Animal {
Horse() {
System.out.println("You have created a Horse");
}
public void walk() {
System.out.println("Walks on 4 legs");
}
}
class Chicken extends Animal {
public void walk() {
System.out.println("walk on 2 legs");
}
}
public class TestAbstraction {
public static void main(String args[]) {
Horse h1 = new Horse();
h1.walk();
h1.eat();
// Animal animal = new Animal();
// animal.walk();
}
}