fork download
  1. class Person
  2. {
  3.  
  4. public void display()
  5. {
  6. System.out.println("parent");
  7. }
  8. }
  9. class Stu extends Person
  10. {
  11.  
  12. public void display()
  13. {
  14. System.out.println("child");
  15. }
  16.  
  17. public static void main(String[] args)
  18. {
  19. Stu st = new Stu();
  20. st.display();
  21. Person P = new Stu();
  22. P.display();
  23. }
  24. }
Success #stdin #stdout 0.11s 54536KB
stdin
1234
stdout
child
child