I never thought before, only I used the method
Deprecated. As of Java 2 platform v1.2, replaced by.
Fetches a portion of the text represented by the component. Returns an
empty string if length is 0.
For security reasons, this method is
deprecated. Use themethod instead.
getText you get a String (immutable object) that may not be changed (except reflection) and so the password stays in the memory until garbage collected.
getPassword you get a char array that may be modified, so the password will really not stay in memory.