package com.cwcec.tag; class Fruit { } class Apple extends Fruit{} class Animal { public Fruit eat(Fruit fruit) { System.out.println("Animal eat..."); return fruit; } } class Dog extends Animal { public Fruit eat(Apple apple) { System.out.println("Dog eat..."); return apple; } } public class Single { public static void main(String[] args) { Fruit fruit = new Fruit(); Apple apple = new Apple(); Animal animal = new Dog(); animal.eat(apple); } }