Sollicitatievraag bij Merck

What is method overloading and method overriding in Java? Differentiate between them.

Antwoord op sollicitatievraag

Anoniem

18 mrt 2024

method overloading involves defining multiple methods with the same name but different parameter lists within the same class, whereas method overriding involves providing a new implementation for an existing method in a subclass. Overloading is resolved at compile-time based on the method signature, while overriding is resolved at runtime based on the object's actual type.