Java: matching two different type of array

Posted by sling on Stack Overflow See other posts from Stack Overflow or by sling
Published on 2010-04-13T18:45:44Z Indexed on 2010/04/13 18:52 UTC
Read the original article Hit count: 397

Filed under:
|

Hi,

I am doing a password login that requires me to match two array: User and Pass. If user key in "mark" and "pass", it should show successfully. However I have trouble with the String[] input = pass.getPassword(); and the matching of the two arrays.

  String[] User = {"mark", "susan", "bobo"};

  String[] Pass = {"pass", "word", "password"};
  String[] input = pass.getPassword();

  if(Pass.length == input.length && user.getText().equals(User))
  {
     lblstat.setForeground(Color.GREEN);
     lblstat.setText("Successful");
  }
  else
  {
     lblstat.setForeground(Color.RED);
     lblstat.setText("Failed");
  }

© Stack Overflow or respective owner

Related posts about java

Related posts about array