fork download
  1.  
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Employee
  8. {
  9. public void p1()
  10. {
  11. System.out.println("Employee method");
  12. }
  13. }
  14. class Manager extends Employee {
  15. public void c1()
  16. {
  17. System.out.println("Manager method");
  18. }
  19. public static void main(String[] args)
  20. {
  21. Manager cobj = new Manager();
  22. cobj.c1(); //method of Child class
  23. cobj.p1(); //method of Parent class
  24. }
  25. }
Success #stdin #stdout 0.03s 4386816KB
stdin
Standard input is empty
stdout
Manager method
Employee method