Java interview shorts 14 - Liskov substitution principle | polymorphism in Java #javainterview

preview_player
Показать описание
in this video we will discuss about liskov substitution principle from SOLID. we will see a polymorphism example and will expirience how it is connected to Liskov substitution principle.
Рекомендации по теме
Комментарии
Автор

Parent class reference can hold the child class object.
It applies to interface, abstract class and it is also polymorphism

jayakumarsivasankar
Автор

looks like formal logic: realization of genus to species. this is the reason why I really love JAVA.

ramabookstroremalang
Автор

So dynamic method dispatch is called liskov sub?

VishnuVijai_
Автор

As per my knowledge, It is a concept of Inheritance
Here Animal class is Superclass/Parent class and Monkey is Subclass/Child class, so basically it is upcasting we are performing here. Conversion of subclass type into superclass type as Upcasting or Implicit Type casting

Gautam_Mandaliya
Автор

@seleniumexpress can u give ur answer here with brief explanation?

santhoshchandran
Автор

Method over riding Run time /dynamic polymorphism

nellainayagam
Автор

After achieving inheritance only- we can able to create the object like that.
So I think the answer is inheritance.

sudheerbommisetti
Автор

It is having has-A relationship, so the answer is inheritance

lathasrikoyya
Автор

Run time polymorphism many say its inheritance but with inheritance only we can achieve run time polymorphism

Why?

Because first compiler check if there is animal class and monkey class are fefined if its class file will be created next in runtime monekey object will be created and assigned address to animal variable so it is run time time polymorphism

mohamedasifar
Автор

You have already given answer in title 😅

amitbhagat
Автор

Poly- many ways to represent the same thing

HR-pzts
Автор

Upcasting, we do this to achieve abstraction 😁.

kunalkakkar
Автор

Monkey class is extending Animal class without that you can not create object as Animal A= new Monkey() so answer should be Inheritance but most comments are indicating Polymorphism can anyone explain why polymorphism?

movietrailer
Автор

This is not Liskov principle. This is just polymorphism.

abhilashpatel