This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem comparing strings...  RSS feed

 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!