---
title: "what is difference between method overloading and method overriding"  
description: "what is difference between method overloading and method overriding"  
author: "Amit Singh"  
published: 2010-10-19  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/58/what-is-difference-between-method-overloading-and-method-overriding  
category: "oops"  
tags: ["oops"]  
reading_time: 2 minutes  

---

# what is difference between method overloading and method overriding

**Method overloading** means having two or more methods with the same name but different signatures in the same scope. Compiler automatically select the most appropriate method based on the parameter supplied.\
\

```
public class multiplynumber{public int multiply(int x, int y){return x * y;}public int multiply(int x, int y, int z){return x*y*z;} }
```

\
**Method Overriding** is achieved when a subclass overrides non-static methods defined in the superclass, following which the new method implementation in the subclass that is executed.\
The new method definition must have the same method signature and return type.\

```
Clas A{Virtual void sum (int a){}}Class B:A{public overrid void sum (int a){}}
```

\
\

## Answers

### Answer by Pushpendra Singh

**Method overloading** means having two or more methods with the same name but different signatures in the same scope. Compiler automatically select the most appropriate method based on the parameter supplied.\
\

```
public class multiplynumber{public int multiply(int x, int y){return x * y;}public int multiply(int x, int y, int z){return x*y*z;} }
```

\
**Method Overriding** is achieved when a subclass overrides non-static methods defined in the superclass, following which the new method implementation in the subclass that is executed.\
The new method definition must have the same method signature and return type.\

```
Clas A{Virtual void sum (int a){}}Class B:A{public overrid void sum (int a){}}
```

\
\


---

Original Source: https://www.mindstick.com/interview/58/what-is-difference-between-method-overloading-and-method-overriding

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
