• Post Reply Bookmark Topic Watch Topic
  • New Topic

String comparision  RSS feed

 
sujesh Katri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can someone explain me that "in String comparision == not working and equals works well" why == not work with String. I'm placing my code below.
if(a1.equals(s))---works well
if(a1==s)--not working
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps this will help: AvoidTheEqualityOperator (<-click).
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start with our FAQ.

Edit: That is the same link Jelle posted.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!