0

Char over string

Why Char array is preferred over String for storing password?

29th Jan 2017, 8:42 AM
pallavraj5
pallavraj5 - avatar
1 ответ
+ 2
Since Strings are immutable there is no way contents of Strings can be changed because any change will produce new String, while if you char[] you can still set all his element as blank or zero. So Storing password in character array clearly mitigates security risk of stealing password. ... char[] is less vulnerable.
30th Jan 2017, 4:25 PM
Ravi anshuman
Ravi anshuman - avatar