fork download
  1. class shit {
  2. public static void main(String[] args){
  3. Employee e = new employ("kupa", "asdfgghj", 12412312);
  4. e.mailCheck();
  5. }
  6. }
  7.  
  8. abstract class Employee {
  9. private String name;
  10. private String address;
  11. private int number;
  12.  
  13. public Employee(String name, String address, int number) {
  14. System.out.println("Constructing an Employee");
  15. this.name = name;
  16. this.address = address;
  17. this.number = number;
  18. }
  19.  
  20. public double computePay() {
  21. System.out.println("Inside Employee computePay");
  22. return 0.0;
  23. }
  24.  
  25. public void mailCheck() {
  26. System.out.println("Mailing a check to " + this.name + " " + this.address);
  27. }
  28.  
  29. public String toString() {
  30. return name + " " + address + " " + number;
  31. }
  32.  
  33. public String getName() {
  34. return name;
  35. }
  36.  
  37. public String getAddress() {
  38. return address;
  39. }
  40.  
  41. public void setAddress(String newAddress) {
  42. address = newAddress;
  43. }
  44.  
  45. public int getNumber() {
  46. return number;
  47. }
  48. }
  49.  
  50. class employ extends Employee {
  51. public employ(String name, String address, int number){
  52. super(name, address, number);
  53. }
  54. }
  55.  
  56.  
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
Constructing an Employee
Mailing a check to kupa asdfgghj