Site hosted by Angelfire.com: Build your free website today!
       
The Digital Reference Section

JAVA Method Over Loading
Rodelio P. Barcenas

Method Overloading exist in JAVA if there are more than one methods of the same name.

public class methodOverload{

public static void main(String[] arg){

String name = "Rodelio Barcenas";
int amount = 10000;

display(name);
display(amount);
display();

}

// Method overloading below

public void display(String s){

System.out.println("Method1");
System.out.println(s);

}

public void display(int a){

System.out.println("Method2");
System.out.println(a);

}

public void display(){

System.out.println("Method3");

}

 

}

The PinoyTechZone.Com
Copyright 2002-2003
All rights Reserved