I know that Object.equals() compares the value of object in heap memory. and == compares the references.
But when I am running my code I am getting both as equal.
public class test3 {
    public static void main(String args[]){
        test2 ts = new test2();
        test2 tss = new test2();
        if(ts.a == tss.a){
            System.out.println("they are equal");
        }else
            System.out.println("they are unequal..");
        if(ts.a.equals(tss.a)){
            System.out.println("equal");
        }else
            System.out.println("not equal..");
    }
}
public class test2 { String a= "soumya"; } 
 
     
     
     
     
    