// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class OOPFun {
    public static void main(String[] args) {
        Fruit o = new Apple();
        o.doit();
    }
}

abstract class Fruit {
    public void doit() {
        System.out.println("I like " + getName());
    }
    public abstract String getName();
}

class Apple extends Fruit {
    @Override
    public String getName() {
        return "apples";
    }
}

class Pear extends Fruit {
    @Override
    public String getName() {
        return "pears";
    }
}
