본문 바로가기
백엔드기술/개발언어

Overload Demo

by RevFactory 2009. 12. 9.

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