Answer: true true false Can anybody explain the difference between 1st and last answers in the output. As per my understanding, even first answer shoud be false.
What is s3 ? A typo perhaps. Strings created without the new operator exist in a String pool. If two Strings in the pool are the same, the references are fly weighted to point to the same object thus == is satisfied. With the new operator however you also have a String object on the heap