fork(2) download
  1. class Employee {
  2. int empNo;
  3. public void disp() {
  4. System.out.println("empNo : " + empNo);
  5. }
  6. }
  7. class Sales extends Employee {
  8. String custName;
  9. public void disp() {
  10. super.disp();
  11. System.out.println("custName : " + custName);
  12. }
  13. }
  14. class Company {
  15. public static void main(String[] args) {
  16. Employee emp = new Employee();
  17. Sales sal = new Sales();
  18.  
  19. emp.empNo = 100;
  20. sal.custName = "Best Company";
  21.  
  22. sal.disp();
  23. }
  24. }
Success #stdin #stdout 0.09s 27804KB
stdin
Standard input is empty
stdout
empNo : 0
custName : Best Company