fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class A
  8. {
  9. public void show()
  10. {
  11. System.out.println("In A show");
  12. }
  13. }
  14.  
  15. class B extends A
  16. {
  17.  
  18. public void show()
  19. {
  20. System.out.println("In B show");
  21. }
  22. }
  23.  
  24. /* Name of the class has to be "Main" only if the class is public. */
  25. class Ideone
  26. {
  27. public static void main (String[] args) throws java.lang.Exception
  28. {
  29. // your code goes here
  30. A obj = new B();
  31. obj.show();
  32. }
  33. }
Success #stdin #stdout 0.08s 52492KB
stdin
Standard input is empty
stdout
In B show