Polymorphism in thinking in Java