#6.4 Java Tutorial | Method Overriding | Super Keyword

Publié le: 03 février 2018
sur la chaîne: Telusko
214,537
3.1k

Method Overriding:
what we have been discussed in this lecture?
a)method overriding
b)use of super keyword

What is method Overriding?
It is way to override the parent class method in child class .

class Parent{
int a;
public void show{System.out.println("this is parent");}
}
class Child extends Parents{
int a=10; //override a
public void show(){System.out.println("this is child method");} //method override by child class

public void useParentShow(){
super.show();
}
}

class Main{
public static void main(String []args){
Child c=new Child();
c.show(); //call the child class override method
c.useParentShow(); //get result of parents method
}

}

b) Now you are interested to use parents class show() then for that super keyword come into picture
whenever you want to use parents class method or variable in child class then we can use it by super keyword;

class Child extends Parents{
int a=10; //override a
public void show(){System.out.println("this is child method");} //method override by child class

public void useParentShow(){
super.show(); //help to use method of parents class
}
}

Instagram :   / navinreddyofficial  
Linkedin :   / navinreddy20  
Discord :   / discord  

More Learning :

Java - https://bit.ly/3xleOA2
Python :- https://bit.ly/3H0DYHx
Django :- https://bit.ly/3awMaD8
Spring Boot :- https://bit.ly/3aucCgB
Spring Framework :- https://bit.ly/3GRfxwe

Servlet & JSP :- https://bit.ly/3mh5CGz
Hibernate Tutorial :- https://bit.ly/3NWAKah
Rest API | Web Service Tutorial :- https://bit.ly/38RJCiy

Git :- https://bit.ly/3NUHB3V
JavaScript :- https://bit.ly/3mkcFys
Kotlin :- https://bit.ly/3GR2DOG


Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
http://www.telusko.com/contactus


Sur cette page du site, vous pouvez voir la vidéo en ligne #6.4 Java Tutorial | Method Overriding | Super Keyword durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Telusko 03 février 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 214,537 fois et il a aimé 3.1 mille téléspectateurs. Bon visionnage!