class Demo {
    public static void main(String[] args) {
        String a=new String("data");
        String b="data";
        if(a==b)                             // return false
            System.out.println("a and b has same reference address");
        else
            System.out.println("not same");
In case of new keyword object, does "data" is actually store in Stringconstant pool .if it is stored then variable a and b both have same reference address and return true, if not then false.
String c=new String("data").intern();
String d="data";
if(c==d)
    System.out.println("true");
else
    System.out.println("false");
   }
}
And also if we use intern() method both variable have same reference address,that mean intern() method is use to store String in String Constant pool. I'm little bit confused , anyone help
 
    