File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
I agree. Here's the link:
subject: problem comparing strings...
jQuery in Action, 3rd edition