आप इस लिंक के साथ के माध्यम से जाना यदि यह आप स्पष्ट कर सकते हैं और अधिक Oracle Docs String Builder Buffer Capacity
अब आप किसी भी StringBuilder वर्ग की क्षमता घोषित करने के लिए चाहते हैं, तो एक निर्माता StringBuilder(int initCapacity)
इस के लिए परिभाषित किया गया है।
StringBuilder(int initCapacity)
:- Creates an empty string builder with the specified initial capacity.
यहाँ पैरामीटर की वजह से int
के रूप में अधिकतम क्षमता है कि एक StringBuilder
कक्षा तक पहुँचने है सकते हैं 2147483647
हो जाएगा।
StringBuilder
कक्षा में क्षमता के इस संदर्भ के संबंध में विभिन्न विधियां हैं, ये विधियां int
प्रकार के मानकों पर भी विचार करती हैं।
void setLength(int newLength) :- Sets the length of the character sequence. If newLength is less than length(), the last characters in the character sequence are truncated. If newLength is greater than length(), null characters are added at the end of the character sequence.
void ensureCapacity(int minCapacity) :- Ensures that the capacity is at least equal to the specified minimum.
ये विधियां भी int
प्रकार के रूप में तर्क लेती हैं। इसलिए, इन विधियों या संरचनाओं का उपयोग करके आप 2147483647
की अधिकतम क्षमता वाला ऑब्जेक्ट उत्पन्न कर पाएंगे।
स्रोत
2016-06-28 05:39:54
और यदि यह अधिकतम सीमा से अधिक हो तो क्या होता है? –