I am trying to verify if the references are equal with below code.
package com.test.oracleinterviewquestions;
public class StringTest {
  public static void main(String args[]){
    StringTest obj=new StringTest();
    obj.testString();
  }
  public void testString(){
    String s1=new String("you cant change me!");
    String s2=new String("you cant change me!");
    System.out.println("s1==s2: is "+s1==s2 );
    String s3="you cant change me!";
    System.out.println("s1==s3: is "+s1==s3);
    String s4="you cant change me!";
    System.out.println("s3==s4: is "+s3==s4);
    System.out.println("---------------------");
   }
}
Lets refer to the values as "yccm" in short for for "you cant change me!". As S1 is created, a entry will be created in heap with rerefence s1 and another one entry in scp but with out reference.
Now, when i create S3, it will point to the existing value in SCP which got created for s1, in scp ,also, when i define S4, it will also point to existing YCCM value in SCP. But, when i print S3==S4, its returning false. please let me know whats the behavior

 
     
     
     
     
     
     
    