Method Overloading :
Method overloading is the example of compile time polymorphism.
Some of the limitation in Java when we are declare the method within the class. We can't declare two methods in a class which have same name and signature and parameters.
So that we can overload such method by following process :
We can use same method name for both the methods but we are required to pass the parameters different to those methods.
It depends on type of argument, No. of argument, Sequence of argument.
Method Overriding :
Method overriding is performed in such case when we have two different classes and they are linked each other through Inheritance.
Both the classes contains method which have same name, signature and Argument.
Method overloading is the example of compile time polymorphism.
Some of the limitation in Java when we are declare the method within the class. We can't declare two methods in a class which have same name and signature and parameters.
So that we can overload such method by following process :
We can use same method name for both the methods but we are required to pass the parameters different to those methods.
It depends on type of argument, No. of argument, Sequence of argument.
Method Overriding :
Method overriding is performed in such case when we have two different classes and they are linked each other through Inheritance.
Both the classes contains method which have same name, signature and Argument.