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 Base{
  9. public Object getValue(){ return new Object(); } //1
  10. }
  11.  
  12. class Base2 extends Base{
  13. public String getValue(){ return "hello"; } //2
  14. }
  15.  
  16. class TestClass{
  17. public static void main(String[] args){
  18. Base b = new Base2();
  19. System.out.println(b.getValue()); //3
  20. }
  21. }
Success #stdin #stdout 0.08s 54524KB
stdin
Standard input is empty
stdout
hello