fork(5) 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. // your code goes here
  13. String a = "hello" + " world!";
  14. String b = "hello world!";
  15. boolean compare = (a == b); // This return true
  16. System.out.println(compare);
  17. a = "hello";
  18. b = "hel" + "lo";
  19. compare = (a == b); // This return false
  20. System.out.println(compare);
  21. a = "Bye";
  22. a += " bye!";
  23. b = "Bye bye!";
  24. compare = (a == b); // This return false
  25. System.out.println(compare);
  26. a = "Bye bye!";
  27. b = "Bye";
  28. b += " bye!";
  29. compare = (a == b); // This return false
  30. System.out.println(compare);
  31. }
  32. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
true
true
false
false