Java - Programming Language
This course covers the basics of programming in Java. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Inheritance (Extends)

Lesson 34
Author : 🦒
Last Updated : October, 2017


Code

Copyclass Chef{
     public void makeChicken(){
          System.out.println("The chef makes chicken");
     }

     public void makeSalad(){
          System.out.println("The chef makes salad");
     }

     public void makeSpecialDish(){
          System.out.println("The chef makes a special dish");
     }
}

class ItalianChef extends Chef{
     public void makePasta(){
          System.out.println("The chef makes pasta");
     }

     @Override
     public void makeSpecialDish(){
          System.out.println("The chef makes chicken parm");
     }
}

public class App{
     public static void main(String [] args){
          Chef myChef = new Chef();
          myChef.makeChicken();

          ItalianChef myItalianChef = new ItalianChef();
          myItalianChef.makeChicken();
     }
}