이 링크를 통해 가면이 당신을 취소 할 수 있습니다 더 Oracle Docs String Builder Buffer Capacity
지금 당신은 어떤의 StringBuilder 클래스의 용량을 선언하려면, 다음 하나의 생성자 StringBuilder(int initCapacity)
이 정의됩니다.
StringBuilder(int initCapacity)
:- Creates an empty string builder with the specified initial capacity.
여기 StringBuilder
클래스 도달되는 수 있기 때문에 파라미터 int
와 최대 용량 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
인 개체를 생성 할 수 있습니다.
최대 제한을 초과하면 어떻게됩니까? –