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

ConstructorEx

by RevFactory 2009. 12. 9.

package java_samples_hwang;

/**
 * Constructor example program
 * @author hwang
 */
public class ConstructorEx {
int empId;
String empName;

    public ConstructorEx(int empId, String empName) {
        this.empId = empId;
        this.empName = empName;
    }
    public void printData()
    {
        System.out.println("EmpID :"+empId);
        System.out.println("EmpName:"+empName);
    }
   

}
class prog
{
    public static void main(String args[])
    {
    ConstructorEx objCons = new ConstructorEx(5, "Minho");
    objCons.printData();
    }
}

 

'백엔드기술 > 개발언어' 카테고리의 다른 글

Overload Demo  (0) 2009.12.09
InheritanceDemo  (0) 2009.12.09
Connect sample  (0) 2009.12.09