What is method overloading in java? Tell me any example

Asked on September 16, 2014
give the example of methodoverloading in java

Replied on September 16, 2014
Method Overloading: When a class have multiple method by same name with different different argument is know as method overloading.

public class MethodOverload {
void sum(int a, int b)
void sum(int a, int b, int c)
public static void main(String[] args) {
MethodOverload ob= new MethodOverload();
ob.sum(12, 8);
ob.sum(10, 10, 10);


Write Answer

©2024 concretepage.com | Privacy Policy | Contact Us