Is it correct to initialize a String as
String value = new String("test");
value of string is assigned in multiple places and if value is null, then default value which is test should be taken, which means if I declare
String value = null;
at some point I have assign a value if in code no value is assigned.
String value = "test";I don't understand what you mean with the second part of the question.if(str != null && your conditions)if value is assigned null, then you want to change it to "test" by default?