Say I have a method:
public String getString() {
char[] array = new char[]{'a', 'b', 'c'};
return new String(array);
}
Is the array still copied in the String constructor or is the Java compiler smart enough to recognize that the elements in the array cannot change so it can just reference the array?
Thanks
Stringsource code.javac?