Java program to demonstrate polymorphism