File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comparing Strings After Using BufferedReader

 
Joe Lank
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 10 is where I seem to have a problem. I want it to evaluate to true. Works fine when I initialize the string to 'test' right before doing the if statement, but not when inputting 'test' from the keyboard.

Or do I just need explicit casting?



PS - Thanks Darin that work great.
[ June 18, 2004: Message edited by: Joe Lank ]
 
Darin Niard
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strings are classes, not primitive types like ints or chars. So, use the equals method.

I'm not sure if the BufferedReader leaves the newline character in or not, so check that out as well.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic