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 IdeoneBase{
  8.  
  9. public String getName(){
  10. return "P";
  11. }
  12. }
  13.  
  14. /* Name of the class has to be "Main" only if the class is public. */
  15. class Ideone extends IdeoneBase
  16. {
  17. @Override
  18. public String getName(){
  19. return "K";
  20. }
  21.  
  22. String getSpecificName(int x){
  23. if(x == 1){
  24. return super.getName();
  25. }
  26. return getName();
  27. }
  28.  
  29. public static void main (String[] args) throws java.lang.Exception
  30. {
  31. IdeoneBase piece = new Ideone();
  32. if(piece instanceof Ideone){
  33. Ideone p = (Ideone) piece;
  34. System.out.println(p.getSpecificName(1));
  35. System.out.println(p.getSpecificName(999));
  36. }
  37. }
  38. }
Success #stdin #stdout 0.08s 380160KB
stdin
Standard input is empty
stdout
P
K