What Is Method Overriding In Java- Runtime Polymorphism In Java

Поділитися
Вставка
  • Опубліковано 8 вер 2024

КОМЕНТАРІ • 30

  • @ajeeshajayan578
    @ajeeshajayan578 3 роки тому +1

    Thank you for the explanation.
    When parent class reference refers to the child class object
    then, which method will be called method of the child class or method of parent class?

    • @Mukeshotwani
      @Mukeshotwani  3 роки тому +1

      Parent class

    • @ajeeshajayan578
      @ajeeshajayan578 3 роки тому +1

      @@Mukeshotwani Thanks for your reply. So here, the parent class methods and overridden methods of child class(if any) will be called. Am I right?

    • @Mukeshotwani
      @Mukeshotwani  3 роки тому +1

      Hi Ajeesha I have discussed all possible scenarios here ua-cam.com/video/6Er5pIEiscI/v-deo.html

    • @venkateshmarneni385
      @venkateshmarneni385 2 роки тому

      Child method will be called

  • @naveenautomationlabs
    @naveenautomationlabs 4 роки тому +4

    Perfect explanation, thanks for sharing it.

  • @venumadhav9311
    @venumadhav9311 3 роки тому +3

    Your videos are simple and easy to understand

  • @nayabshaik2282
    @nayabshaik2282 2 роки тому

    Great Thanks Mukesh for your efforts to make us understand easily..

  • @Imran-M-
    @Imran-M- 4 роки тому +1

    Hi Mukesh, thanks for the video!
    Could you please post a video explaining the scope of "default" and "protected" access modifiers and real time implementation?

  • @TheFiretiger20
    @TheFiretiger20 3 роки тому +1

    it will be even more helpful if you show us some real life example in selenium . appreciate your work.

  • @jhilimishra3364
    @jhilimishra3364 2 роки тому

    Thank you sir .

  • @akashakhil2391
    @akashakhil2391 3 роки тому +1

    Hello Mukesh,
    One question related to interface seeing the video when you compared overriding with implementation, can we just left the methods declaration as is and not write the body in the method which is getting override/implementing case of implementing an interface?
    How should it work? Thanks in advance :)

    • @Mukeshotwani
      @Mukeshotwani  3 роки тому +1

      Hi Akash,
      if you dont write anything inside the method (while implementing) then it wont make any sense. Even if you have no statement it will be method with no output.

  • @monalikajain
    @monalikajain 4 роки тому +1

    Hii Mukesh...great explaination...but have one doubt...
    In case of Inheritance:
    Parentclass obj= new childclass()
    then...we are able to get parentclass methods.
    but in case of method overriding:
    Parentclass obj= new childclass()
    we are able to get child class methods.
    Is it correct??????

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому +2

      Hi Monali, in this case Parentclass obj= new childclass()
      both parent class and child class has same method so child class method will get called because it is overriding feature.

  • @shaiksameer2776
    @shaiksameer2776 4 роки тому +1

    In dynamic binding we can use super keyword to call parent class method?

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому +1

      Hey Sameer yes if parent and child class has same method then super.method() can be used.

    • @shaiksameer2776
      @shaiksameer2776 4 роки тому

      😊👍👍

  • @gaurabsharma2961
    @gaurabsharma2961 4 роки тому +1

    Hi,
    when I am implementing the methods of interface, I am also getting the @Override annotation also. Do I need to remove the annotations?

    • @Mukeshotwani
      @Mukeshotwani  4 роки тому

      Its not mandatory gaurav, you can either keep or remove.

  • @nainagupta4949
    @nainagupta4949 Рік тому

    so in overloading, we define a method with the same name but the signature is required and in overriding, we define the same name method but signature is not must??

  • @justworkfine321
    @justworkfine321 2 роки тому +1

    But what to answer when interviewer ask that why runtime polymorphism decide to overiding why overiding is decided fot runtime polymorphism

    • @Mukeshotwani
      @Mukeshotwani  2 роки тому +2

      Hi RB, because method behavior changes depends on object or reference.

  • @sonamsoni3208
    @sonamsoni3208 3 роки тому +1

    Hi Mukesh, What kind of guidance I will get if I join your you Tube channel by paying amount 159, please guide me.

    • @Mukeshotwani
      @Mukeshotwani  3 роки тому

      Hey Sonam, it is just a support program. Its completely optional.

  • @mounikamouni1619
    @mounikamouni1619 4 роки тому

    Thank you Sir