When calling 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.
When calling getPassword
you get a char array that may be modified, so the password will really not stay in memory.