#56 Dynamic Method Dispatch in Java

Описание к видео #56 Dynamic Method Dispatch in Java

Check out our courses:

Enterprise Java Spring Microservices: https://go.telusko.com/enterpriseJava
Coupon: TELUSKO10 (10% Discount)

Master Java Spring Development : https://bit.ly/java-spring-cloud
Coupon: TELUSKO20 (20% Discount)

Udemy Courses:

Java:- https://bit.ly/JavaUdemyTelusko
Spring:- https://bit.ly/SpringUdemyTelusko
Java For Programmers:- https://bit.ly/javaProgrammers

For More Queries WhatsApp or Call on : +919008963671

website : https://courses.telusko.com/

in this video we are discussing method dispatch

-- in previous lecture we had discussed what is polymorphism
-- in this lecture we are further talking about run time polymorphism
-- suppose we have some class A , B and C
-- class B and C extends A
-- in All three class we have show() method
-- main() method of Demo we create object of A, B and C but we create only reference of A which can hold
object of A, B and C .
class A{
public void show(){
Systeem.out.println("in show A");
}
}
class B extends A{
public void show(){
Systeem.out.println("in show B");
}
}

class C extends A{
public void show(){
Systeem.out.println("in show C");
}
}

public class Demo{
public static void main(String []args){
A obj =new A();
obj.show(); //Output: in show A

obj =new B(); //reference is A (we can use reference of parents) and create object of B and assign to parents reference variable.
obj.show(); //Output: in show B

obj =new B(); //reference is A (we can use reference of parents) and create object of C and assign to parents reference variable.
obj.show(); //Output: in show C


}
}

Note: during compile time we donot which show() method is called from which class.
-- we can know during run time which show method is called this is known as run time polymorphism.
-- all this concept is class dynamic method dispatch

Github repo : https://github.com/navinreddy20/Javac...

Java:- https://bit.ly/JavaUdemyTelusko
Spring:- https://bit.ly/SpringUdemyTelusko

More Learning :

Java :- https://bit.ly/3x6rr0N
Python :- https://bit.ly/3GRc7JX
Django :- https://bit.ly/3MmoJK6

JavaScript :- https://bit.ly/3tiAlHo
Node JS :- https://bit.ly/3GT4liq

Rest Api :-https://bit.ly/3MjhZwt
Servlet :- https://bit.ly/3Q7eA7k
Spring Framework :- https://bit.ly/3xi7buh
Design Patterns in Java :- https://bit.ly/3MocXiq
Docker :- https://bit.ly/3xjWzLA

Blockchain Tutorial :- https://bit.ly/3NSbOkc
Corda Tutorial:- https://bit.ly/3thbUKa
Hyperledger Fabric :- https://bit.ly/38RZCRB

NoSQL Tutorial :- https://bit.ly/3aJpRuc
Mysql Tutorial :- https://bit.ly/3thpr4L

Data Structures using Java :- https://bit.ly/3MuJa7S
Git Tutorial :- https://bit.ly/3NXyCPu

Donation:
PayPal Id : navinreddy20
https://www.telusko.com

Комментарии

Информация по комментариям в разработке