Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Employee
- {
- private int empnum;
- private String empname;
- public Employee()
- {
- System.out.println("Start Employee");
- }
- public Employee(int num,String name)
- {
- empnum=num;
- empname=name;
- }
- public void setEmpNum(int num)
- {
- empnum=num;
- }
- public int getEmpNum()
- {
- return empnum;
- }
- public void setEmpName(String name)
- {
- empname=name;
- }
- public String getEmpName()
- {
- return empname;
- }
- public void display()
- {
- System.out.println("EmployeeNo: "+empnum);
- System.out.println("Employee'sName: " +empname);
- }
- }
- public class TestEmployee
- {
- public static void main(String [] args)
- {
- Employee e1= new Employee();
- Employee e2=new Employee(123, "sdf");
- e2.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement