Portfolio

Polymorphism


package polymorphism;

public class tuna extends food {

void eat() {
System.out.println("this is tuna is great");
}
}

public class potpoie extends food {

void eat() {
System.out.println("this is potpoie is great");
}
}

 

public class fatty {
public void digest(food x) {

x.eat();
}

}

 

public class apple {

public static void main(String[] args) {

fatty bucky = new fatty();

}
}