Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem comparing strings...

 
Colleen Lynch
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing a simple comparison that isn't giving the result I think it should:
<code>
String type = chartBean.getChartType(); //return "LINE"
if (type.equals("LINE")) {
// rest of code here
}
</code>
If I print out type, it does in fact print LINE, however, type.equals("LINE") returns false.
What am I missing here?
Thanks...
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a space in there? Sometimes there is
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic