Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class apples {
- public static void main(String[] args){
- food bucky[]=new food[2];
- bucky[0]=new potpie();
- bucky[1]=new tuna();
- for(int x=0;x<2;++x){
- bucky[x].eat();
- }
- }
- }
- public class potpie extends food {
- void eat(){
- System.out.println("this potpie is great");
- }
- }
- public class tuna extends food{
- void eat(){
- System.out.println("this tuna is great");
- }
- }
- public class food {
- void eat(){
- System.out.println("this food is great");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement