What is the difference between overloading and overriding a
function?

Answer Posted / ankur dhoot

In overloading two function should have different signature
but overriding show have exactly same signature.

Overloading generally happens in same class but overriding
mandatory requires super and sub class to happen.

Compiler decides overloading at compile time but overriding
is detected at run time.

Overloading is called static polymorphism while overriding
is called dynamic polymorphism.

Is This Answer Correct ?    53 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain enumeration in java?

569


Does constructor be static?

566


What is operator overloading. Is it is supported in java?

524


Why collection doesn’t extend cloneable and serializable interfaces?

643


How do you convert an int to a string in java?

546






Can we call a non-static method from inside a static method?

561


What is formatted output in java?

500


Why scanner is used in java?

550


Why is sizeof not a function?

549


What are default methods ?

580


How do you square a number?

583


Why generics are used in java?

552


What is file in java?

562


what is the volatile modifier for? : Java thread

521


Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?

546