Does this makes a difference in memory consumption/performance?
private static final String name = "text";
// new string is created and passed in new Test-Object
public Test create1(){
return new Test("text");
}
// static final string passed (as reference?) in new Test-Object
public Test create2(){
return new Test(name);
}
Imagine having 100000 objects, then for create1, a string is created every time. create2 does not create a new string every time. Am I right?