Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

ArrayList String Matching Help  RSS feed

 
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I  have a program I am writing to compare an external file list of names to a user entered name.

While I am typing in a name from the list, exact to case, it is still returning a false boolean value on the match,

I even created System output lines to confirm the values match and yet I cannot get it to return true.

Ive tried equals. and equals.IgnoreCase() as well and while the case is identical on the Strings, I cannot get it to return TRUE.

I understand there may be other ways to approach this program, I have to try to use the processes we have learned in our course (which I have mentioned here) if I can, even if there is a better way of doing it. I'm assuming I will learn that in the next course.

I'm just trying to understand what I am not understanding properly.

Any help is appreciated

Class:



Demo Program:

 
Marshal
Posts: 64168
215
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your loop tests whether the current name is the same, and then goes to a different name, which won't be the same.
Please note what I said about indentation about your other post.
 
ice is for people that are not already cool. Chill with this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!