File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Test User Input Sting to Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Test User Input Sting to Object" Watch "Test User Input Sting to Object" New topic

Test User Input Sting to Object

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1562
I can not get the following code to work. It never matches eventhough I know it should:

I unencrypt the password from the remote data then I test it against the user input string.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

In this code:I can see that unEncriptedpassWord is a PasswordClass object. But what about arg1? I suspect it is a String. Am I right? If that's the case, it can never be equal to a PasswordClass object. You would have to extract a String from that PasswordClass object and compare that to arg1.
Michael Labuschagne
Ranch Hand

Joined: May 08, 2007
Posts: 56

The code below doesn't explain much about what is happening, you'd have to show the code for "PasswordClass" and there is no reference to what the arg1 object/variable is. If it an object and is not overriding the Object classes equals() method than the all that "if statement" is doing is checking if the unEncriptedpassWord object and the arg1 object are the same object.

Please provide more information reqarding the classes involved.

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1562
Here is my PasswordClass:

Here is the LogOnConnetion class that calls the PasswordClass:

I agree. Here's the link:
subject: Test User Input Sting to Object
It's not a secret anymore!