Passwords are recommended to be stored in char[] instead of String, as Strings are stored in StringPool. Read more here
As per this question Strings in StringPool are not available directly. To obtain Strings in Stringpool, we would need a password-dictionary to check them in StringPool. If we have a password-dictionary, we don't need to worry about StringPool, we can anyhow try directly on password fields.
So, why should we not use "String" as a datatype for passwords?
EDIT:
The answer obtained is: We can have access to memory dump and get access to Strings in stringpool.
Follow up questions:
- How can one access the memory dump?
- Can the access be prevented?
- If access to memory dump is prevented, Is it safe to use String as a type for passwords?