I have a doubt in String comparisons. i am clear about toString(),==& equals.But still could not make up logic for the answers .
1. "SCJP"=="scjp".toUpperCase(); //FALSE ..How.. ,But according to literal pool concept , "scjp".toUpperCase() result would go to literal pool 2. String s1="SCJP"; String s2=""; s1==s1+s2 //FAlSE ..How
Each of these expressions result in a new String, which is not a literal, and not in the pool (unless intern is called on it). Therefore, the == comparison will return false, because these are new objects.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
"SCJP"=="scjp".toUpperCase(); this expression is already having a refernce to SJP in literal pool when toUppercase() ,produces SCJP ,isnt its reference picked from literal pool. result produces false, but i thought it should be true