List a few differences between overloading and overriding?

devquora
devquora

Posted On: Dec 22, 2020

 

Few differences between overloading and overriding are as follows:

S. N.Method overloadingMethod overriding
(1)In this, methods must have the same name and different signatures.While in this, methods must have the same name and same signature.
(2)Method overloading is performed within class.Method overriding occurs in two classes that have IS-A (inheritance) relationship.
(3)In case of method overloading, parameters must be different.In case of method overriding, parameters must be the same.
(4)Method overloading is the example of compile time polymorphism.Method overriding is the example of run time polymorphism.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    HCL Java Developer Interview Questions

    What is Multithreading in Java?

    Multithreading is a programmable approach to achieve multitasking. Multithreading in Java is a process of executing multiple threads cumulatively. A thread is the smallest unit of processing which is ...

    HCL Java Developer Interview Questions

    What use of intern() method in String?

    In Java, intern() is a native method of the String class. The String.intern () returns a reference to the equal string literal present in the string pool. The intern () method is applicable to String ...

    HCL Java Developer Interview Questions

    What is Collection Framework?

    A Java collection framework is an architecture that was added to Java 1.2 version. The Collection Framework provides a well-designed set of classes and interfaces for storing and manipulating a group ...