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. /* Name of the class has to be "Main" only if the class is public. */
  8. class T1
  9. {
  10. public void f() {
  11. System.out.println ("hello I'm f() in T1");
  12. }
  13. }
  14. class T2 extends T1
  15. {
  16. public void f() {
  17. System.out.println ("hello I'm f() in T2");
  18. }
  19. }
  20.  
  21.  
  22. class Ideone
  23. {
  24. public static void main (String[] args) throws java.lang.Exception
  25. {
  26. T1 o = new T2();
  27. o.f();
  28. // your code goes here
  29. }
  30. }
Success #stdin #stdout 0.04s 320576KB
stdin
Standard input is empty
stdout
hello I'm f() in T2