Use the equals method instead of == , equals method does a comparision of the value of the string, when you do == you are actually trying to see if 'myString' object and "Sam" object are same or not, which will be same only if they point to the same object.
So doing a comparision...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.