The main reason for character array being preferred over string is the immutable nature of string. What that means is, if the password is stored as plain text then it would be available in the memory until the garbage collector clears it, and since it is immutable, there is no way the content of the string can be changed, changing it would result in entirely different (new) string.
This leads to the less secure nature of strings as compared to character arrays, as they are stored in plain text and anyone getting a hand on them would have access to raw passwords. Incase of array you could explicitly wipe the data, overwrite the array and raw data is not available anywhere, contrary to string which makes it more vulnerable.