aspose file tools*
The moose likes Beginning Java and the fly likes Problem with Array search Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem with Array search" Watch "Problem with Array search" New topic
Author

Problem with Array search

Karl Vaicek
Greenhorn

Joined: Mar 01, 2010
Posts: 11
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

Joined: Oct 27, 2005
Posts: 19790
    
  20

== uses object instance equality. Use the equals method to compare your strings instead.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Karl Vaicek
Greenhorn

Joined: Mar 01, 2010
Posts: 11
Thank you!!!
Karl Vaicek
Greenhorn

Joined: Mar 01, 2010
Posts: 11
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

Joined: Oct 27, 2005
Posts: 19790
    
  20

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Array search