#6.4 Java Tutorial | Method Overriding | Super Keyword

Pubblicato il: 03 febbraio 2018
sul canale di: 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


In questa pagina del sito puoi guardare il video online #6.4 Java Tutorial | Method Overriding | Super Keyword della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Telusko 03 febbraio 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 214,537 volte e gli è piaciuto 3.1 mille spettatori. Buona visione!