IBM Interview Question

What would you choose for a password field in JAVA, a character array or String?

Interview Answer

Anonymous

Jun 9, 2021

Char array should be preferred. Because if you define it as a string it will be written in string pool and will be available until next restart.