阅读程序,回答问题:public class Fruit {
public void show()
{
System.out.println("This is a fruit!");
}
}
public class Apple extends Fruit{
public void show()
{
System.out.println("This is an apple!");
}
}
public class Orange extends Fruit {
public void show()
{
System.out.println("This is an orange!");
}
}
public class Test {
public static void main(String args[])
{
Fruit ft=new Apple();
ft.show();
ft=new Orange();
ft.show();
}
}
(1)程序的输出结果是什么?
(2)实现多态的三个必要条件是什么?