There are certain cases where this makes sense. Java strings are a good example. When a string is created in Java, it refers to an array of character substitution (a char[]). He knows the offset in the char array and the length of the string. When you create a substring, it refers to the same base array. Now consider this code:
String x = buildVeryLongString();
String y = x.substring(0, 5);
, y , , char[], x, - . , , . :
String x = buildVeryLongString();
String y = new String(x.substring(0, 5));
char[]. x y , ( ), , x - y, .
, . BufferedReader.readLine() 80 , ( ) , readLine(), char[] 80 . , !
, , , , . , , , .
.NET - , . (, IntPtr .NET, .) "" , . :
StringBuilder builder = new StringBuilder(10000);
builder.Append("not a lot");
string x = builder.ToString();
, x, . builder.ToString().Copy() , . , - , .