This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes problem comparing strings... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem comparing strings..." Watch "problem comparing strings..." New topic

problem comparing strings...

Colleen Lynch

Joined: Jun 18, 2001
Posts: 15
I am doing a simple comparison that isn't giving the result I think it should:
String type = chartBean.getChartType(); //return "LINE"
if (type.equals("LINE")) {
// rest of code here
If I print out type, it does in fact print LINE, however, type.equals("LINE") returns false.
What am I missing here?
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

is there a space in there? Sometimes there is
It is sorta covered in the JavaRanch Style Guide.
subject: problem comparing strings...
Similar Threads
Print content inside the div tag
Processing XML with Java question
What does $str =~ m/\/// do?
extracting strings
printing index of an collection in JSP using JSTL