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 Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. String str = new String("foo");
  12. String str2 = new String("foo");
  13. String str3 = "foo";
  14. String str4 = "foo";
  15.  
  16. System.out.println(str == str2);
  17. System.out.println(str == str3);
  18. System.out.println(str3 == str4);
  19. }
  20. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
false
false
true