Conceptually overloading and overriding is way different. Only the notion about interface name is same in both cases. Other than that, you cannot find a common thing between them.
Overloading is using the same interface but with different inputs and getting different behaviour as output. Slightly confusing right. I hope by end of this article you may feel better.

Not Overloading
Overriding is in picture when there is inheritance. When you are inheriting a object there are so many behaviours associated with it. Primarily you are inheriting to use the common behaviour and attributes. But in certain cases, you may not like a particular behaviour. In such cases, you overwrite that behaviour alone in your inherited instance. The interface will be same.
Overloading is not polymorphism. Run time binding is not polymorphism. All these and more are used to exercise the property polymorphism. Polymorphism is a more general property belonging to object-oriented programming parlance and demands a separate article by itself. Let’s discuss that in detail then.
Overloading
Now let’s continue to discuss overloading and overriding. I have shown an image of a overloaded truck. I specifically used this image and drawn a wrong mark on it. Because, when I did some research on this topic using internet almost all web pages where ever overloading is discussed this kind of overloaded truck image is used to explain the meaning. Please get it right. Overloading is not adding more and more attributes and interfaces to the object so that it looks bulkier. In fact, when you use overloading for the outsiders view the object will look compact. That is putting more behaviour with same interface. That is your object will look sleek.

Before Overloading
I have shown two images, one is Harmonium, a classical music instrument from India. Just for understanding it is a very trimmed version of piano. The other is a modern digital keyboard. Harmonium is without overloading and keyboard is after overloading. In a digital keyboard, keys are the interface, in programming method name. Speaker is the output, in programming return type of the method. When the player presses the keys he gives input to the method and gets output as music through the speakers.

After Overloading
Following line is very important to understand the complete correlation. When different input is given you get different out put. Here the interface (method name, keys) is same and output type is same. But the actual input (arguments, key press sequence) and output (returned data, music) is different. This is overloading. Look at the whole object (keyboard), how sleek it is after overloading.
Example java source code for overloading:
public class OverloadExample {
public static void main(String args[]) {
System.out.println(playMusic("C sharp","D sharp"));
System.out.println(playMusic("C","D flat","E flat"));
}
public static String playMusic(String c, String d) {
return c+d;
}
public static String playMusic(String c, String d, String e){
return c+d+e;
}
}
Overriding
It is very simple and easy to understand. When you inherit an object, you don’t like certain behaviour and so you replace it with your own. Note the word replace. Because after overriding the old behaviour is completely obsolete. Now look at the image of a monster truck. Here the old small four wheels are replaced with huge wheels to suit the current need. This is overriding.

Some specific points about overloading in Java:
A java private method cannot be overridden because in first place it is not accessible to an inheriting object.
Final parameter in the overloaded method, has an interesting behaviour which I leave it for your exercise ;-)
An example for overriding from java package:
Implicitly every object in Java is extended from Object class. Object has a method named equals. This implementation compares the passed object with the current object and returns true if the reference are same. In String class you don’t want this behaviour. Therefore, equals method of the Object class is overridden in String class with its own implementation. Here the behaviour is modified to check if the character sequence is same as the compared one and returns true. This is a classic example of overriding.















Nice comprehensive information sir….Thanks.
Suresh on October 7th, 2009 11:56 pmNice example to understand the concepts easily Thanks
chaitanya on December 18th, 2009 10:55 pmNicest example that I have ever seen or think of for these blury concepts “overloading” and “overriding” in my 12 years exposure to java. Your simple way of explaining is superb! Hearty thanks & wishes!!
Andy on January 15th, 2010 2:42 pmvery very thank u sir …very nice explanation sir
veera on January 27th, 2010 7:23 pmthanks a lot for explanation………..
dipankar on February 4th, 2010 5:24 pmThis information is superb.Thanx alot.I understand this topic very easily by those examples. Thanq
sujana on February 23rd, 2010 6:32 amA nice way to explain OL and OR.
Vishal on June 15th, 2010 11:45 amAwesome…
Muthukumar on August 1st, 2010 2:15 pmNice Observation. Thanks
Mitesh Agrawal on November 29th, 2010 11:11 amGreat explanation
Asim Nawaz on December 2nd, 2010 3:55 pmwow…simply superb
ps.krishna on December 28th, 2010 6:14 pmthnx sir it is helpful for understanding overloading and overriding.
mukesh on March 4th, 2011 3:00 pmthanks
Nicest example to explain the two confusing concepts of OOPS.
thank u sir
amit on March 15th, 2011 6:02 amsir,overriding is explained very nicely but overloading concept is also nice but the use of word”interface” is quite confusing….
Anonymous on April 12th, 2011 12:26 pmreally good!!! thks
Anonymous on April 14th, 2011 1:37 am(it is Just Good For Beginers)..
RaamNaresh Reddy on April 29th, 2011 10:17 amAnd…. It is not Sufficient…for others
Give Two three Programatical Examples…
Nice explanation!
Sonoo jaiswal on May 21st, 2011 6:47 amCan you give a code example for over riding like over loading….?
Zeeshi on June 13th, 2011 5:22 pmOverloading simplest example
public class OverLoad
{
void sum(int x, int y)
{
int sum=x+y;
System.out.println(“sum is: “+sum);
}
void sum(int x, int y, int z)
{
int sum=x+y+z;
System.out.println(“sum is: “+sum);
}
public static void main(String arg[])
{
OverLoad ol=new OverLoad();
ol.sum(5,4);
ol.sum(5,4,3);
}
}
o/p-> sum is: 9
sum is: 12
Overriding simplest example
class A
{
void calculate(int x, int y)
{
int sum=x+y;
System.out.println(“sum is: “+sum);
}
}
public class B extends A
{
void calculate(int x, int y)
{
int product=x*y;
System.out.println(“product is: “+product);
}
public static void main(String arg[])
{
B b=new B();
b.calculate(5,4);
}
}
Run this code o/p will be 20
class A
{
void calculate(int x, int y)
{
int sum=x+y;
System.out.println(“sum is: “+sum);
}
}
public class B extends A
{
/*void calculate(int x, int y)
{
int product=x*y;
System.out.println(“product is: “+product);
}*/
public static void main(String arg[])
{
B b=new B();
b.calculate(5,4);
}
}
run this code o/p will be 9
now i think u are clear… if still not. leave the comment
Nitin on June 22nd, 2011 8:53 amSimply great!!!!
Mukesh on June 22nd, 2011 9:39 amGreat!!!.nice real world eg. to explain the core concept.
Eshu on June 26th, 2011 5:54 amThanx buddies….!!!
Nitin on June 28th, 2011 3:38 amyour concept is very clear please send me some concept and example in my email related to applet,exception ,thread… Thanks
Mukesh kumar on July 2nd, 2011 10:30 amJoseph , I could not digest “Run time binding is not polymorphism”.But I believe it is otherwise. Overloading is static binding since at compile time it is bind,And also overloading is not polymorphism”, whereas overriding is polymorphism since it is binded at runtime.
Clear the confusion
Abhiram on July 4th, 2011 11:51 amoverloadin=it is the relation biw the method declare in supper class and subclass having thr same method name name diffirent no input and diffirent type of input–;;; for eg
anand on July 6th, 2011 11:08 pmpublic void m1()// no argument constructer
public void m1(int i)// argumenter contructer
public void m1(inti,String s)// this is all about the method overloading
Nice Explanation
Raja Ramesh on July 14th, 2011 12:38 pmDear Joseph, this is the very simple and easy to understand article.so we are thank to you………………
Kiran on July 14th, 2011 4:05 pmIf example is given for overriding then it would be possible to understand more clearly….
Bharati on July 18th, 2011 11:37 amexample is given above in my comments
Nitin on July 21st, 2011 8:59 amIs it true that Overloading is not a polymorphism?
Praveen on July 21st, 2011 11:34 amthis overloading and overriding concept is very clearly explained,and before reading this topic i didn’t understand these two task difference,now am understand completely. thank to you
chandru on July 26th, 2011 8:22 amnice sir…
usharani pasala on August 2nd, 2011 9:49 amHi joe!
Ram Gowtham on August 8th, 2011 7:43 amSo gud!
All your answers are awesome relating to realtime easy understanding thank you for sharing your knowlegde. can you please explain java polymorphism it hasnt been very clear to me all time although partially i understand still not clear.
thanks
raji on August 19th, 2011 8:14 pmraj
safgs
dg on October 14th, 2011 1:36 pmHi,
In one of the interview I got this question:
Consider this example:
class P {
public void abc() {
}
Now class C inherits class P
class C extends class P{
public void abc() {
// adds some additional functionality;
}
Now, here is the question:
Due to some reasons if you want the functionality of abc method of class P (i.e parents )in child’s class, then how we can achieve this?. Is it through key word super?
I understand this is very strange, but it was asked in interview
Thank u,
Anonymous on October 21st, 2011 4:02 pmGive an example when you can not overload a method in Java.
keerthi on October 27th, 2011 2:03 amnice :))
dennise on November 16th, 2011 10:38 amwow simply super…..great explanation .thank u
sree on November 18th, 2011 2:36 pmhi its really useful 4 me to understand tanqu…
Archu on November 19th, 2011 11:52 amConsider this example:
class P {
public void abc() {
}
Now class C inherits class P
class C extends class P{
public void abc() {
// adds some additional functionality;
}
Now, here is the question:
Due to some reasons if you want the functionality of abc method of class P (i.e parents )in child’s class, then how we can achieve this?. Is it through key word super?
I did not understand the question here..
Can’t we do like this –
P sup = new P();
P sub = new C();
sup.abc(); //Calls super class method
sub.abc(); //Calls sub class method
Please let me know if its not correct..
Thanks,
Deepesh on November 21st, 2011 5:50 amDeepesh
Thanks Sir, its very nice and very easy to understand that.
kashif on November 29th, 2011 6:35 pmthnx sir it is helpful for understanding all concepts. Iam a beginner,I want to download all your core concepts for java, How Can i download, please send to my mail.
Thanxs a lot, great job!!!
vasu pulavarthi on November 30th, 2011 6:37 amcan u override the static method?many of people asking this question.
edukondalu a on December 9th, 2011 4:25 pmYES OR NO
IF YES GIVE AN SUITABLE EXAMPLE WITH EXPLANATION.
PLEASE HELP ME IN ABOVE QUESTION…
edukondalu a on December 9th, 2011 4:26 pmAOA
Very Informative Post & Blog – Keep doing Sir :)
Best Regards;
Muhammad Kamran on December 12th, 2011 7:56 ami want more clarification plz give more without confusion
Anonymous on January 19th, 2012 12:47 pmi want more clarification
sravan on January 19th, 2012 12:48 pmcan the main function be overloaded??
malay ranjan sahu on January 20th, 2012 11:49 am(public void static main(String []args))
this is the very simple and easy to understand article.so we are thank to you………………
Mayur on January 24th, 2012 12:08 pmgood one :-)
Anonymous on January 25th, 2012 2:34 pm[...] of ‘a class’. Unlike inheritance, you can choose any single object of a class and modify its behaviour leaving the other instances [...]
Decorator Design Pattern&hellip on January 29th, 2012 6:34 pmThanks for explaining in a simple language.
K S Ravikumar on February 2nd, 2012 10:30 amGood Work :)
Gokul on February 2nd, 2012 11:22 amhi jo..thank you so much…its very useful website…
Karunakar
Kannaaa on February 7th, 2012 11:20 amThere are times when your article is complete and one requries no more reading.
this is NOT one of them. Please try to put some examples and rules/protocol associated.
eg: you didnt explain the access modifiers / scope in over-riding
eg: return type in overloading
gud effort nevertheless…
Java Learner on February 9th, 2012 11:20 amThankyou so much..!
Anonymous on February 9th, 2012 4:01 pmNice one sir….
Anonymous on February 11th, 2012 4:23 pmexcellent !
can u give some more example in c++
Shilpi
shilpishilpisrivastav on February 13th, 2012 6:05 pmAmazing way of drilling the concept of Overloading and Overriding into the head.
Thanks Joe
Noel on February 14th, 2012 11:34 amcan return type differ in overloading and overriding?
pranav on February 18th, 2012 12:04 pmNice one, Thanks…..
mubashir on February 26th, 2012 5:12 pmnice explanation but little bit confusion can u please explain it clearly…….
seshu dheeraj on February 28th, 2012 5:54 pmReally good and practical
Ajit on February 29th, 2012 2:03 pmnice artical
Anonymous on March 2nd, 2012 7:39 pm@Nitin:Good one…:-)
Sam on March 7th, 2012 12:04 pmvery nice example with real world…:)
Anonymous on March 7th, 2012 3:09 pmThank you sir :) i got to know the concept
Anonymous on March 14th, 2012 12:23 pmcan you override the static.
pallavi on March 21st, 2012 11:36 amno you cannot override the static
sabarishreddy on March 22nd, 2012 3:59 pmi really thanks to you very much ……i understood both concept very well.
puneet verma on March 24th, 2012 12:46 amnice
prakash on April 9th, 2012 10:59 amAwesome explaination…thanks
Vijay on April 16th, 2012 6:16 pmthnks sir nyc explaination………..
abhi shukla on April 20th, 2012 12:27 amthank u sir
loving example and awlanationesome exp
Anonymous on April 24th, 2012 3:48 amNitin given this example to explain overriding but i have a doubt in this below example that is “What is the use of extending A class in B?” without extending that class also we will get the same result na…
Overriding simplest example
class A
{
void calculate(int x, int y)
{
int sum=x+y;
System.out.println(“sum is: “+sum);
}
}
public class B extends A
{
void calculate(int x, int y)
{
int product=x*y;
System.out.println(“product is: “+product);
}
public static void main(String arg[])
{
B b=new B();
b.calculate(5,4);
}
}
Run this code o/p will be 20
Raju on April 26th, 2012 10:53 pmGood explanation with nice examle
sathya on May 11th, 2012 11:19 pmthank uuuuuu sir