title: Why is char[] preferred over String for passwords?
body: <p>In Swing, the password field has a <code>getPassword()</code> (returns <code>char[]</code>) method instead of the usual <code>getText()</code> (returns <code>String</code>) method. Similarly, I have come across a suggestion not to use <code>String</code> to handle passwords.</p>
  
  <p>Why does <code>String</code> pose a threat to security when it comes to passwords?
  It feels inconvenient to use <code>char[]</code>.</p>