This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Searching Arrays  RSS feed

 
Gezelle Ealey
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting error message that the symbol cannot be found for array values in the search.
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use String.equals(String) for comparisons of Strings because "==" requires that the Objects be the same Object, not just contain the same value.
 
Paul Clapham
Sheriff
Posts: 22468
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really understand your code. You're comparing entries in the arrays to two different things, and both have to be equal. But you only have one ID field and one password field -- shouldn't you be comparing the contents of those things to your array entries?

And also you're comparing the array entries (in the wrong way, as Les already said) to variables which I don't see declarations for anywhere. Is your mysterious error message perhaps referring to those variables?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!