hello there!
Please Explain
if(" String ".trim() == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
Answers
1. the code will compile an print "Equal".
2. the code will compile an print "Not Equal".
3. the code will cause a compiler error
The answer is 2.
When you compare two string objects with a "==", thats means you are comparing the object references. and definitely they are not equal.
the answer would have been 1, if the condition was
if(" String ".trim().equals("String"))