In the print statement i have given a long underscore with some text. it is not appearing.
Because, those underscore was concatenated with att
and checked to referential equality(==
) with ptt
, and prints false, becuase concataneted String and ptt
are not referentially equal. Change it like following to get you desired output
System.out.println("__________________________att == ptt________"+(att == ptt));
att==ptt
gives false when it is given with in print statement. and true when it is given in if condition.
Both are referring same String literal in String constant pool, but, in the previous case(your 1st question), att
was concatenated with the under score and compared with ==