List few difference between overloading and overriding?

holothuroid
holothuroid

Posted On: Jan 07, 2021

 

Few difference between Overloading and Overriding are as follows:

OverloadingOverriding
Overloading is the situation when two or more methods in one class have the same method name but different parameters.Overriding is the situation that means having two methods with the same method name and parameters (i.e., method signature). One of the methods is in the parent class and the other is in the child class.
The real object type in the run-time, not the reference variable's type, determines which overridden method is used at runtime.Overriding allows a child class to provide a specific implementation of a method that is already provided by its parent class. In contrast, reference type determines which overloaded method will be used at compile time.
Polymorphism applies to overriding.Polymorphism does not apply to overloading.
Overriding is a concept of run-time.Overloading is a concept of compile-time.

    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 ...