String s17="AMIT";
String s18="amit";
String s19=" amit ";
System.out.println(s19.trim()==s18);-false
System.out.println(s19.trim().equals(s18));-true
System.out.println(s18.toUpperCase()==s17);-false
System.out.println(s18.toUpperCase().equals(s17));-true
I just want to clear my doubt. Do substring, replace, trim & to UpperCase all String methods returns new instance? I just conclude from above output.
Correct me if I am wrong.