Java Overloaded Methods

Java Overloaded Methods:

We can use the Eclipse IDE for this example. If you do not know about it then follow this link- How to Install Eclipse For Java and create a program in it.

Java allows a method to be overloaded. Method overloading occurs when a class has two or more methods with the same name but different parameter lists. Having more than one method with the same name might seem unnecessary, but method overloading is used quite frequently in Java.

Java Overloading Methods
public class Method_Overloading {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		int i = multiplication(2,3,3);
		System.out.println(i);
		
		
    }
	
	static int multiplication(int u, int v) {
		System.out.println("This is Java Overloaded Method #1");
		return u * v;
		
	}
	
	static int multiplication(int u, int v, int w) {
		System.out.println("This is Java Overloaded Method #2");
		return u * v * w;
		
	}

	static int multiplication(int u, int v, int w, int x) {
		System.out.println("This is Java Overloaded Method #3");
		return u * v * w * x;
		
	}

}

Tutorial MySQL
Tutorial Python
Procedure-Oriented Programming
Modular Programming
Object-Oriented Programming (OOP)
C++ Character Set and Program Structure
FOR Loop in C Language
Java (programming language)– Wikipedia

Comments (No)

Leave a Reply