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 Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. A1 a1 = new A1();
  13. A2 a2 = new A2();
  14.  
  15. print(a1, "asdfasdf");
  16. print(a2, "xcvxcv");
  17. }
  18.  
  19. public static void print(A1 a1, String str) {
  20. System.out.println("Hey a1!" + str);
  21. }
  22.  
  23. public static void print(A2 a2, String str) {
  24. System.out.println("Hey a2!" + str);
  25. }
  26.  
  27. public static class A {}
  28.  
  29. public static class A1 extends A {}
  30.  
  31. public static class A2 extends A {}
  32. }
Success #stdin #stdout 0.13s 55508KB
stdin
Standard input is empty
stdout
Hey a1!asdfasdf
Hey a2!xcvxcv