if("String".toString() == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
this returns Equal. Is this because it reurns the same
String object?
and in other example
if(" String ".trim() == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
returns not equal because trim() returns a new String object(as contain substring).
Am i right in this regard? could anyone explain this more to me?