I know that it is unsafe to store passwords as Strings in java source code. Generally it is a good idea to store it in variable having char[] type. Is it safe to store password in following form?
char[] password = "my password".toCharArray();
Does string "my password" appear in compiled java class file? As far as I can see, "my password" does not appear in my class file after I have compiled the source code. But I am still not 100% sure that I can store password using described representation.
Could I safely use this construct and be sure password is protected unless somebody gets it from the source code?
EDIT: what if I store key instead of password in described format: "key".toCharArray()? Does it reduce chance of my password to be hacked?