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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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
Processing XML with Java question
Print content inside the div tag
printing index of an collection in JSP using JSTL
extracting strings
What does $str =~ m/\/// do?