Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. class Employee
  2. {
  3. private int empnum;
  4. private String empname;
  5.  
  6. public Employee()
  7. {
  8. System.out.println("Start Employee");
  9. }
  10. public Employee(int num,String name)
  11. {
  12. empnum=num;
  13. empname=name;
  14. }
  15.  
  16. public void setEmpNum(int num)
  17. {
  18. empnum=num;
  19. }
  20.  
  21.  
  22. public int getEmpNum()
  23. {
  24. return empnum;
  25. }
  26.  
  27. public void setEmpName(String name)
  28. {
  29. empname=name;
  30. }
  31.  
  32. public String getEmpName()
  33. {
  34. return empname;
  35. }
  36.  
  37.  
  38. public void display()
  39. {
  40. System.out.println("EmployeeNo: "+empnum);
  41. System.out.println("Employee'sName: " +empname);
  42. }
  43.  
  44. }
  45.  
  46. public class TestEmployee
  47. {
  48. public static void main(String [] args)
  49. {
  50. Employee e1= new Employee();
  51. Employee e2=new Employee(123, "sdf");
  52. e2.display();
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement