• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Array search

 
Karl Vaicek
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, everyone,

I'm programming socket, but my protocol doesn't work fine.. Client sends card number (xxxx xxxx xxxx xxxx) which is defined in servers protocols string array.


(that's not the whole code)

But problem is somewhere here, because if I enter corect card number (which is defined in array), i get :

>Your card is not in our database. Try again 1111 0000 1111 0000 0

I think, that my for loop is alright, but I don't understand why it's not working...

I will be grateful for your help!
 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
== uses object instance equality. Use the equals method to compare your strings instead.
 
Karl Vaicek
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!!!
 
Karl Vaicek
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:== uses object instance equality. Use the equals method to compare your strings instead.


THANK YOU! That was so easy, but i couldn't figure it out :/
 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic