Binding In Java | Static Binding Vs Dynamic Binding | Static and dynamic binding | In Hindi-49

Поделиться
HTML-код
  • Опубликовано: 3 дек 2024

Комментарии • 8

  • @ktjagadish890
    @ktjagadish890 3 года назад

    What a explanation... Super handwriting.. 😲WOW

  • @SandeepKumar-so2st
    @SandeepKumar-so2st 6 лет назад

    Sir servlet ka bhi lecture uploads kar de please.

  • @arupnaskarbkp
    @arupnaskarbkp 6 лет назад

    Showing AdMob Interstitial ad even after closing the app ..please soluation

  • @muhammadzohaib9563
    @muhammadzohaib9563 4 года назад +2

    learn to write clean

  • @SagarSagar-ro3fj
    @SagarSagar-ro3fj 6 лет назад

    4.40 ..i think i am confused and contradicts wat u say..we can call childs method with parents reference.can u explain what happens here in below program?
    Parent class:
    public class JavaParent {
    int x=10;
    public void disp()
    {
    System.out.println("This is parent display and value of x is:"+x);
    }
    }
    Child class:
    public class JavaChild extends JavaParent {
    int x=20;
    public void disp()
    {
    System.out.println("this is child method and value of x is:" +x);
    }
    public static void main(String[] args) {
    JavaChild j = new JavaChild();
    j.disp();
    System.out.println(j.x);
    JavaParent p = new JavaChild();
    p.disp(); //how does this call child method ?
    System.out.println(p.x);
    }
    }
    O/P:
    this is child method and value of x is:20
    20
    this is child method and value of x is:20
    10

    • @princebhatia09
      @princebhatia09 4 года назад

      hi sagar,
      When you have two methods with same name in two different classes and you want to called child class method but with the reference of other class you can use dynamic binding which is explained in above video
      in your example you are asking you are asking your parent class to call the method of child class.
      Your parent can call his method only and child can call his method and parent method also parent class cannot call child methods so here we use dynamic binding
      JavaParent p = new JavaChild();
      your parent class is calling the method of child class