fork download
  1. class Demo
  2. {
  3.  
  4. public static void main(String[] args) throws java.lang.Exception
  5. {
  6. String x = "hello";
  7. Object y = x;
  8. System.out.println(x == y);
  9. System.out.println(f(x) == f(y));
  10. }
  11.  
  12. public static int f(String x) {
  13. return 1;
  14. }
  15.  
  16. public static int f(Object y) {
  17. return 2;
  18. }
  19.  
  20. }
Success #stdin #stdout 0.09s 321600KB
stdin
Standard input is empty
stdout
true
false