Can anyone whats going behind the scenes for the followig code snippets
Q1)
******************************************
if("
String ".trim() == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
Answer is "Not Equal"
******************************************
Q2)
******************************************
if("String".substring(0,6) == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
Answer is "Equal"
******************************************
Q3)
******************************************
if("String".replace('g','G') == "String".replace('g','G'))
System.out.println("Equal");
else
System.out.println("Not Equal");
Answer is "Not Equal"
******************************************
Q4)
**********************************************
if("String".replace('t','t') == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
Answer is "Equal"
********************************************
Thanks