Computer Science, asked by merup2inderizangull, 1 year ago

difference between overloading and overriding in java

Answers

Answered by adithya7
1
Function overloading or method overloading is a feature found in various programming languages such as Ada, C++, C#, Delphi, D, Java, and Swift, that allows creating several methods with the same name which differ from each other in the type of the input and the output of the function.

The ability of a subclass to override a method allows a class to inherit from a superclass whose behavior is "close enough" and then to modify behavior as needed. The overriding method has the same name, number and type of parameters, and return type as the method that it overrides.


rishilaugh: :)
Answered by Anonymous
0
Overloading happens at compile-time while Overriding happens at runtime: The binding of overloaded method call to its definition has happens at compile-time however binding of overridden method call to its definition happens at runtime. Static methods can be overloaded which means a class can have more than one static method of same name. Static methods cannot be overridden, even if you declare a same static method in child class it has nothing to do with the same method of parent class.

rishilaugh: thanks
Similar questions