- JAVA OVERVIEW
- History of Java
- Tools you will need for java
- Java Environment Setup
- Popular Java Editors
- Java Basic Syntax/First-Program
- Java Identifiers
- Java Modifiers
- Java Arrays
- Java Enums
- Java Keywords
- Comments in Java
- Java - Objects and Classes
- Objects in Java
- Classes in Java
- Constructors
- Creating an Object
- Accessing Instance Variables and Methods
- Source file declaration rules
- Java Package
- Simple Case Study
- Basic Data Types
- Primitive Data Types
- Reference Data Types
- Java Literals
- Variable Types
- Local variables
- Instance variables
- Class or static variables
- Java Access Modifiers
- What is OOPS
- Inheritance concept
- Encapsulation
- What is Polymorphism
- Method Overloading
- Method Overriding
- Abstraction in Java
- Abstract class
- Interface in Java
- Method overloading in Java:
- What is Annonymous object?
- Java 8
Method overloading in Java: Concept Behind
When a class contains multiple methods with the same name and with different parameters is known as Method overloading.
If we have to perform only one operation in the program, having the same name as the methods increase the readability of the program.
Consider if we have to perform addition of the given numbers but there can be any number of arguments. If you use two parameters in a method such as
MethodName(int int){}
if you want to use three parameters in a method such as
MethodnNme2(int, int, int){}.
Now, it may be difficult to understand the behaviour of the method for you as well as other programmers, because its name differs. That’s why we use method overloading to figure out the program quickly.
Advantage of method overloading:
It increases the readability of the program.
Different ways to overload the method
There are two ways to overload the method in java:-
1. By changing the number of arguments
2. By changing the data type