getText() vs getPassword()

后端 未结 4 1102
-上瘾入骨i
-上瘾入骨i 2020-12-01 17:57

I\'m currently designing a login system for a make-believe company, right now all I have is the Main login, which needs a lot of cleaning up. Below is my login handler.

4条回答
  •  一向
    一向 (楼主)
    2020-12-01 18:09

    JPasswordField.getPassword() returns a char [] instead of a String. This is done for the sake of security. You should compare the characters inside the array instead of seeing if the char [] .equals(a String);

提交回复
热议问题