Difference between overloading and overridding?

Answer Posted / tulasi

Overloading is the concept where there are many methods
with the same name in a class but the arguments passed
differ.Consider the example of method called
addition.Addition can be between integers,floating point
numbers etc., so same name addition is used for the various
methods of class but the parameters passed differ, it may
be integer or floating point.When the jvm checks for the
methods, the method is choosen depending upon the argument
passed.

Overriding is the concept where the method name is
same,arguments passed are also same and the return type is
also same.but the method implemented depends upon where its
defined and called

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between static (class) method and instance method?

584


What is protected in java?

536


Give few difference between constructor and method?

526


What is stream api in java8?

544


How do you reverse a word in java?

535






Explain the public class modifier?

509


Can classes declared using the abstract keyword cab be instantiated?

567


Can one thread block the other thread?

613


What is a locale?

707


What will be the default values of all the elements of an array defined as an instance variable?

564


How does multithreading take place on a computer with a single cpu?

556


'A class is a template for an object' explain this statement.

554


What is equlas() and hashcode() contract in java? Where does it used?

623


What is empty string literal in java?

569


What is the difference between this() and super() in java?

549