Simple polymorphism/inheritance example in Java