All about Method overloading
To define the same name method for more than one time in one class with same signature and different arguments this concept is called as method overloading.


Signature means : [In Java]
Access specifiers, Return type and method name.


Write a program to define methods overloading.


class over
{
 void fun1
 {
  System.out.println("No argumented method");
 }
 void fun1(int x)
 {
  System.out.println("X is "+x");
 }
 void fun1(int a,int b)
 {
  System.out.println("A is "+a+" B is "+b);
 }
public static void main(String args[])
 {
  over o=new over();
  o.fun1();
  o.fun1(10);
  o.fun1(10,20);
 }
}

Axact

Narendra

Hello, everyone! I am Narendra Bagul founder of Javanotes9. First of all thank you for visiting my blog. Hope you all like my java notes as well. I'm young part time blogger and a Computer Engineering student. I started blogging as a hobby. Now here I'm sharing my little acquired knowledge about my favorite programming language JAVA.

Post A Comment: