I am working with Java code in JSP and I am trying to compare strings and I am having problem with that.
I have declared two strings
s1 = "din";
s2 = "din";
However, the if (s1 == s2)
never executes. Can someone help me?
Answer
You use 'equals' when you compare strings.
if(s1.equals(s2)) { true }
No comments:
Post a Comment