निम्नलिखित स्ट्रिंग वर्गस्ट्रिंग कन्स्ट्रक्टर में 'originalValue.length> आकार' कैसे हो सकता है?
public String(String original) {
int size = original.count;
char[] originalValue = original.value;
char[] v;
if (originalValue.length > size) {
// The array representing the String is bigger than the new
// String itself. Perhaps this constructor is being called
// in order to trim the baggage, so make a copy of the array.
int off = original.offset;
v = Arrays.copyOfRange(originalValue, off, off+size);
} else {
// The array representing the String is the same
// size as the String, so no point in making a copy.
v = originalValue;
}
this.offset = 0;
this.count = size;
this.value = v;
}
के एक निर्माता है लेकिन, मुझे आश्चर्य है कि
if (originalValue.length > size)
कैसे हो सकता है? टिप्पणी कहती है 'सामान को ट्रिम करें', बैगेज क्या है?
इस स्ट्रिंग क्लास के अन्य रचनाकारों और विधियों को देखें। वास्तविक सामग्री के लिए आवश्यकतानुसार सरणी में एक बड़ी आवंटित स्थान के साथ एक स्ट्रिंग बनाने का कोई तरीका है? –