package java_samples_hwang;
/**
*Demp program on Method overloading
* @author hwang
*/
public class OverloadDemo {
public void test()
{
System.out.println("Method with zero parameter");
}
public void test(int a)
{
System.out.println("Method with 1 parameter "+a);
}
public void test(int a,int b)
{
System.out.println("Method with 2 parameters "+a+ "&"+b);
}
}
class Overload
{
public void main(String args[])
{
OverloadDemo obj = new OverloadDemo();
//call versions
obj.test();
obj.test(10);
obj.test(10, 20);
}
}
'백엔드기술 > 개발언어' 카테고리의 다른 글
Override Demo (0) | 2009.12.09 |
---|---|
ConstructorEx (0) | 2009.12.09 |
InheritanceDemo (0) | 2009.12.09 |