What is use of method overloading and overriding?

What is use of method overloading and overriding?

Method overriding means same method has written in both child and parent classes.overloading means write same method with different signatures.But I want to know what is the use of these concepts.how to use this type of polymorphism in real time? thanks in advance

View Answers

April 6, 2011 at 3:46 PM

Overriding is useful when you want to change the functionality of some method based on a class. For example, by overriding the toString() method of Object class, we can use it with different classes.

Overloading is useful to add flexibility to a method. In general, if you want to create a method that adds two numbers then it only take either integer, double, or float but by overloading, you can add values of all data types.

Java Method Overloading

Java Method Overriding









Related Tutorials/Questions & Answers:
What is use of method overloading and overriding?
What restrictions are placed on method overloading?
Advertisements
method overloading
JAv method overloading
Method Overloading
Method Overloading
method overloading
method overloading
method overloading
method overloading in c program
Method overloading in java program
What is Overloading of procedures ?
method overloading - Java Beginners
Method Overloading Example In Java
Main method overloading
Polymorphism : Method Overloading
What is Constructor Overloading in Java?
What is Constructor Overloading in Java?
Java Method Overloading - Java Beginners
Java method overloading
what is the use of Hibernate Sessionfactory close() method?
calculate volume of cube, cylinder and rectangular box using method overloading in java
Overloading
Method Overloading
Overloading
Method Overloading in java
What is an abstract method?
overloading and overriding
What is a native method?
What is the arguement of main method?
what is web .config method
question related to overloading
question related to overloading
what is ment by method signature in java.......
What is the difference between a constructor and a method?
What is the return type of the main method?
What if the main() method is declared as private?
What is the access scope of a protected method?
Constructor overloading in java
What is the difference between GET and POST method?
Overloading in java
write a program to calculate volume of a cube, cylinder, rectangular box using method overloading
What is the first argument of the String array in main() method?
Method overriding or overloading
c++ operator overloading
OVERLOADING AND OVERRIDING - Java Interview Questions
Overloading constructor in flex
What’s the difference between accessing a class method via -> and via ::?
What are the restriction imposed on a static method or a static block of code?
examples for overloading and overriding

Ads