fork download
  1. class Ideone
  2. {
  3. public static void main (String[] args) throws java.lang.Exception
  4. {
  5. String s1 = "Some string";
  6. int a = 1;
  7. String s2 = (a == 1 ? "Some" : "Foo") + " string";
  8. System.out.println("Same? " + (s1 == s2));
  9. System.out.println("Equivalent? " + s1.equals(s2));
  10. }
  11. }
Success #stdin #stdout 0.09s 320512KB
stdin
Standard input is empty
stdout
Same? false
Equivalent? true