Showing posts with label char. Show all posts
Showing posts with label char. Show all posts

Friday, May 25, 2012

Why is char[] preferred over string for passwords?


In Swing , the password field has a getPassword() (returns char[] ) method instead of the usual getText() (returns String ) method. Similarly, I have come across a suggestion not to use String s to handle passwords. Why does String pose a threat to security when it comes to passwords?