Java overloading and overriding

后端 未结 9 1618
暖寄归人
暖寄归人 2020-11-29 08:16

We always say that method overloading is static polymorphism and overriding is runtime polymorphism. What exactly do we mean by static here? Is the call to a method resolved

9条回答
  •  执念已碎
    2020-11-29 09:09

    Simple Definition - Method overloading deals with the notion of having two or more methods(functions) in the same class with the same name but different arguments.

    While Method overriding means having two methods with the same arguments, but different implementation. One of them would exist in the Parent class (Base Class) while another will be in the derived class(Child Class).@Override annotation is required for this.

    Check this : Click here for a detailed example

提交回复
热议问题