What is the difference between overloading and overriding a
function?

Answer Posted / raj kashyap

OVERLOADING is possible to create methods that have the same
name, but different parameters lists and different
definitions.overloading is used when objects are required to
perform similar task but using different parameters.



OVERRIDING is used when we want an object to respond to the
same method but have different behaviour when that method is
called. that means we override the method defined in super
class.yhis is possible by defining a method in subclass that
has same name,same argument& same return typeas method in
super class.

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stack explain?

591


Difference between nested and inner classes ?

699


Write a program to show whether a graph is a tree or not using adjacency matrix.

703


How infinite loop is declared?

645


What is the generic class?

617






Why is java multithreaded?

634


Which package is used for pattern matching with regular expressions?

731


What is integer valueof?

733


What is linkedlist in java?

596


What is a default method?

618


Write a program to find the whether a number is an Armstrong number or not?

670


What is functional interface in javatpoint?

600


How to create an immutable class?

668


What is a boolean flag in java?

656


How does hashset work in java?

672