public class PolyTest2
{
public static void main(String[] args)
{
Fruit f=new Pear();
Pear p = (Pear)f;
p.sing();
}
}
class Fruit
{
public void sing()
{
System.out.println("fruit is singing");
}
}
class Pear extends Fruit
{
public void sing()
{
System.out.println("pear is singing");
}
}