Does a static final String inside a private static method instantiate a new object when invoked?
private static String Test() {
final String foo = "string literal";
return foo;
}
Or does the compiler know there is only a single, string literal, inside the method? Or should I make it a private static final class field? This has the effect of reducing readability by spreading the code around the class.