String sb1 = new String("Soft");
String sb2 = new String("Soft");
System.out.println("ANS1->" +sb1 == sb2);
System.out.println(sb1 == sb2 + " After result");
System.out.println("ANS2->" +sb1.equals(sb2));
This leads to output as below, but i dont understand why "ANS1" and "After result" texts are not displayed. Kindly help on this.
false
ANS2->true
equalsinstead of==as u used in your third output