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 assembly used for?

788


Difference between keyword and identifier.

795


What is array command?

824


When is an object subject to garbage collection?

794


Why main method is static in java?

856


What is the difference between java applets and applications?

863


Why can't you declare a class as protected?

820


Why do we create public static method in java?

824


Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

825


What are the different types of sorting in java?

752


What is bufferedwriter?

756


How many types of methods are there in java?

775


What happens when a thrown exception is not handled?

809


What is the purpose of the enableevents() method?

807


What is meant by collection in java?

801