fork download
  1. class Ideone {
  2. public static void main (String[] args) {
  3. ChildClass c = new ChildClass();
  4. c.methodB();
  5. }
  6. }
  7.  
  8. class ParentClass {
  9. public final void methodA() {
  10. System.out.println("This is Parent A Method");
  11. }
  12.  
  13. public void methodB() {
  14. System.out.println("This is Parent B Method and I am Calling Method A");
  15. methodA();
  16. }
  17. }
  18.  
  19. class ChildClass extends ParentClass {
  20.  
  21. @Override
  22. public void methodB() {
  23. System.out.println("This is Child B Method and I am Calling Parents Method B");
  24. super.methodB();
  25. }
  26. }
Success #stdin #stdout 0.06s 32352KB
stdin
Standard input is empty
stdout
This is Child B Method and I am Calling Parents Method B
This is Parent B Method and I am Calling Method A
This is Parent A Method